On changing rand(3) to random(3) in awk(1)

Lowell Gilbert freebsd-lists at be-well.ilk.org
Thu Aug 28 15:05:23 UTC 2014


Chenguang Li <horus.li at gmail.com> writes:

> Peter Pentchev <roam at ringlet.net> wrote:

>> Of course you're right, it's documented as 2^32-1.  Though now I wonder
>> whether stdlib.h shouldn't provide some kind of RANDOM_MAX constant for
>> this purpose, instead of programs having to do their own hardcoding.
>
> It would be nice to have it as a constant, as RAND_MAX for rand(3).

This comes from the POSIX specification, which specifically calls out
that value even though it specifies the type as a long int. There's no
reason we can't add it to our headers, but it won't be portable.


More information about the freebsd-hackers mailing list