How to obtain a random number, different for every instation of running game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Expezo
:warning: Old Version Published before Godot 3 was released.

As in the title, I was experiencing some problems with creating a random values. Is there any possibility to use function randi() or any else and do not obtain the same result every time the game runs? Even in Tetris example the sequence of falling blocks is always the same, although the function randi() was used there.

P.S. I am sorry for my english, but i am still learning it :slight_smile:

:bust_in_silhouette: Reply From: websterek

I think you need to use randomize() funcion: @GDScript — Godot Engine (latest) documentation in English

:bust_in_silhouette: Reply From: blankocheese

putting randomize() on func _ready() might work…

:bust_in_silhouette: Reply From: Expezo

Thank you both very much, I had tried randomize before and it hadn’t work, but when I tried again a few days ago, I suddenly realised that I’m using it in a wrong order relative to the rest of my code :stuck_out_tongue: Now everything works, so thank you again very much.