Multiplatform Random Number Consistancy

BlitzMax Forums/BlitzMax Programming/Multiplatform Random Number Consistancy

FWIW, the SSI game with the random-generated dungeons, given a seed value, was called "Dungeon Hack" (not a gold-box game).

The MT random number generator code is probably the way to go to insure cross-platform random numbers. It uses integers for all calculations, and it appears to use accepted techniques for generating "nice" random numbers. It should be easy to compile the C code into a Blitz userlib/module. Or, you could dust off yer copy of Numerical Recipes in C and adapt one of the better algorithms to use integers. Fortunately, it's not too terribly hard. I remember doing this back in the 80286/386 days, just so I knew exactly how the generator functioned and could adapt it if needed (and it was nice to be able to optimize it for speed if needed - having too many float operations back then was very bad).

Even given the IEEE standards for floating point math, etc., and the standard nature of the "libc" random number generators like "random", "rand" and "lrand48", etc., my guess is that the results are not guaranteed to match up on different platforms (i.e. different CPUs with different floating point units and different standards compliance) But then again, maybe the standards are enough to ensure portability (one would think this is pretty important). Anyone well-versed in such "standards" issues?

Hope this helps,

Ed