On Sat, Jul 08, 2006 at 09:42:43PM +0000, Cesare Marilungo wrote:
> But hydrogen source uses rand() as a random generator, when I've heard
> that random() is much better (more uniform distribution) and in fact I
> also changed rand() to random() from v0.0.1 to 0.0.2.
>From the man page:
The versions of rand() and srand() in the Linux C Library use the same
random number generator as random() and srandom(), so the lower-order
bits should be as random as the higher-order bits. However, on older
rand() implementations, and on current implementations on different
systems, the lower-order bits are much less random than the higher-
order bits.
And even that doesn't matter unless you use only the lower bits.
There is certainly no difference in the distribution if you divide
by RAND_MAX to a [0...1] float result.
-- FA Follie! Follie! Delirio vano e' questo!Received on Sun Jul 9 04:15:06 2006
This archive was generated by hypermail 2.1.8 : Sun Jul 09 2006 - 04:15:06 EEST