There's no reason that calling
randi() from a timer should cause the same number to be generated each time. You will get the same series of random numbers each time you run the scene, but that's generally not a problem. And, you can fix that by calling
randomize() one time after the scene loads (say, in
For example, this (wired to a
timeout event) outputs a different number with each call:
var val = randi() % 300
I don't really understand your spawing logic though. I'm not sure why you go to the trouble of setting 3 different variables (b, c, and d) based on a random number, but then execute (a copy of) the same code for each of them.
I'm confident that your spawn code can be simplified, but you probably need to better explain what you want the spawner to do...