Author: Tord Romstad
Date: 13:07:55 05/30/04
Go up one level in this thread
On May 30, 2004 at 07:25:09, Uri Blass wrote:
>On May 30, 2004 at 07:11:11, Tord Romstad wrote:
>>
>>Yes. The rand() function gives very low-quality random numbers.
>
>Based on what experience?
From the manual page about the random() function on my PowerBook:
The random() and srandom() functions have (almost) the same calling
sequence and initialization properties as the rand(3) and srand(3) func-
tions. The difference is that rand(3) produces a much less random
sequence -- in fact, the low dozen bits generated by rand go through a
cyclic pattern. All the bits generated by random() are usable. For
example, `random()&01' will produce a random binary value.
I have read similar things in the standard C library documentation on all
other systems I have used. It is possible that there exist implementations
where rand() behaves well, but even if this is the case for your particular
implementation, it doesn't make sense to limit portability for no good
reason.
Tord
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.