Archived

This topic is now archived and is closed to further replies.

Silly_con

Random numbers

Recommended Posts

Ataru    133
I don''t know about fast enough, but I know from my experiments that you can get "more random" with your own. Sometimes you see patterns in the random numbers, you always do, but rand() is rather weak.

Also, rand returns ints, they may want a fast way to return random floats, or ranged random values. Also for hacking purposes, you want to create your own rand, as it is possible to predict random number selection if you have the seed and random number lookup table.

Share this post


Link to post
Share on other sites
jperalta    356
rand() is more than fast enough for most practical applications, unless you intend to call rand() like 700,000,000 times per second I''d recommend you leave well enough alone.

Share this post


Link to post
Share on other sites
acheron761    122
In my experience, rand() can be fuzzy on certain systems. I''d recommend writing your own - speed shouldn''t be an issue, but the randomness of the values you retreive will probably improve with your own.

Share this post


Link to post
Share on other sites
Extrarius    1412
rand() is usually a poor psuedorandom number generator. For a better one that is just as fast (which afaict is a good thing), try the Mersenne Twister.

[edited by - extrarius on October 9, 2003 1:34:37 PM]

Share this post


Link to post
Share on other sites