Random-FunctionArchives Forums/BlitzPlus Programming/Random-Function
| Could it be, that RAND(0,100) generates at every program-start the same number? I've made an asteroids-clone, the planets positions and angles are always the same?!?!|
Is that a bug in BlitzPlus? Is there another way to generate Random-Values???
| See SeedRnd in the docs.|
Basically, do SeedRnd(Millisecs()) at the start of the game.
| Thx, it works great now. :) ... |
| Actually, an interesting thing you can do is turn off the SeedRnd code (by commenting it out) for testing purposes.|
This will generate the same random numbers every time the game is played. In this way, you can predict (by playing the game a few times) what will happen next, and do something accordingly to find out if a specific section of your code is working correctly.
And it's so easy to turn randomness back on.