[uClibc]rand() doesn't generate numbers in the specified range

Alex Holden alex at linuxhacker.org
Sat Mar 16 16:58:08 UTC 2002


Hi, it appears that uClibc rand() (including the latest CVS release) 
doesn't generate numbers in the range 0 to RAND_MAX (defined in stdlib.h 
as 2147483647). If I was to guess, I would say that it appears to 
generate numbers in the range 0 to 32767. This breaks some code I have 
that uses the value of RAND_MAX to scale the output of rand() to a 
double within a specified range.

-- 
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer




More information about the uClibc mailing list