Random number generation usually its implemented as what is known as pseudo-random. Its indeed a too long sequence of numbers, so long that it seems there is no sequence, but not random really (idk if its the way implemented in godot, but results apply). If you run randi every time you start again the game, it will generate the same sequence. What you need is to give a “seed”. A seed is like an index that tells in which part of the pseudo-random sequence start the sequence. As the sequence is so long, different seeds always generate what looks like random numbers.
Godot has a function randomize() that selects that seed for you… Just add randomize() at the beggining of your _ready() function and that should do the trick.
thankyou for explanation
so i dont even need to call it again in other scene with different node and script ?
potatobanana | 2019-01-07 18:00
no, as @MysteryGM answered, just need it once! randomize() selects the seed, and then randi starts following the sequence from that point. Any time you run the game, randomize will select different seed. Once the seed is selected, as the sequence it’s so long, it does not matter if you change it… it will look random.