The same value always appears.

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

The same value always appears.

func _ready():
	var ran = randi() % 100 + 1
	for i in range(ran):
		print(str(ran))
:bust_in_silhouette: Reply From: kidscancode

This is because you need to seed the random number generator. Try adding this at the beginning of your _ready() function:

randomize()

If you don’t do this, you will get the same sequence of “random” numbers on each run.

that’s all right

i found this

justflying | 2017-11-26 14:55