The GNU/Linux random(3) manpage says explicitly:
> The random() function returns a value between
> 0 and RAND_MAX

The same is said in GNU libc docs (info libc "BSD
Random"):
> This section describes a set of random number
> generation functions that are derived from BSD.
> There is no advantage to using these functions
> with the GNU C library; we support them for BSD
> compatibility only.
...
> The value returned ranges from `0' to
> `RAND_MAX'.

This doesn't contradict HP-UX, Tru64, Solaris, BSD
and SUS/XPG, because RAND_MAX on GNU/Linux is
defined as 2^31-1:
> /usr/include/stdlib.h:#define   RAND_MAX        2147483647

Probably, we should use RAND_MAX on GNU (both
Linux and Hurd), and 0x7fffffff on all other
systems?

-- 
With best regards,
xrgtn

Attachment: signature.asc
Description: Digital signature

Reply via email to