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.
Ok, right, on linux they're the same. Thank you. :-P
c.
--