Is random reliable on all CPUs?

BlitzMax Forums/BlitzMax Programming/Is random reliable on all CPUs?

JoshK(Posted 2008) [#1]
Will Rand() and Rnd() work the same on all CPUs and OSs?


SebHoll(Posted 2008) [#2]
I know this is not directly answering your question, but Brucey implemented a better random number algorithm in his BaH.Random module for BlitzMax available with the rest of his collection *here*.


Mark Tiffany(Posted 2008) [#3]
I don't think you can rely on them to generate the same sequence every time, possibly part of the reason for Brucey creating his version?


Gabriel(Posted 2008) [#4]
No they won't. Someone wrote a mersenne twist implementation though, and that should. I think maybe Kanati?

EDIT: Yep

http://www.blitzbasic.com/Community/posts.php?topic=44228


JoshK(Posted 2008) [#5]
Thanks.


Canardian(Posted 2008) [#6]
As long you use Randomize() or Seed() at the beginning of your program, it works better than any theory of random numbers.


GfK(Posted 2008) [#7]
Brucey has a Random module that uses Mersenne twist (I think), which basically duplicates the standard 'random' functions. So you can swap out one module for the other with minimum fuss.

That'll give you the same results on every PC.

[edit] Just noticed SebHoll's link goes to this.