Random Numbers

Archives Forums/Blitz3D Bug Reports/Random Numbers

chaos51(Posted 2007) [#1]
Hi,

I am not sure if you could classify it as a bug, but maybe you could more see it as a "hint", towards somethings that should not be changed in new versions.

For encrypting, I heavily relied on the random number generator to work the same, for the same input seed. After downloading the newest version .98, All my encrypted images were suddenly not decryptable anymore, as the number sequence from Rand has changed. (for a fixed seed).

I admit, maybe lousy programming, but then again, its hard to see what programmers will do with your product.

/C51


Rob Farley(Posted 2007) [#2]
You'll also find that the blitz 'random number' generation is not consistant over all processors.

If you're going to rely on random number generation you'll have to hand roll your own. Google will help you find the algos.


chaos51(Posted 2007) [#3]
Yup, maybe that could be a solution.

I didnt know that the sequences were processor dependend though. That is really good to know,
I definitly have to do something about that ;o)


Rob Farley(Posted 2007) [#4]
http://www.blitzbasic.com/codearcs/codearcs.php?code=1782

Not looked into this but this might solve the problem. I know this is blitzmax but it should be easy enough to convert to blitz.


chaos51(Posted 2007) [#5]
Thanks for the help,

I fixed my problem now, but that'll teach me to not depend on a external implemented random number generator in the future...

I had to hack my own code, to figure out the old "random" numbers, to be able to decode my resources from my previous compiled game... *phew*