Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Aug 2014 11:05:10 -0400
From:      Lowell Gilbert <freebsd-lists@be-well.ilk.org>
To:        freebsd-hackers@freebsd.org
Subject:   Re: On changing rand(3) to random(3) in awk(1)
Message-ID:  <44zjeoejtl.fsf@lowell-desk.lan>
In-Reply-To: <34BC8621-2628-4FD1-9F58-A282B3A96C50@gmail.com> (Chenguang Li's message of "Thu, 28 Aug 2014 22:33:43 %2B0800")
References:  <F70B9462-0898-47EF-AF83-47509F21F84E@gmail.com> <53FEFBB8.5040305@gmail.com> <20140828131526.GA2385@straylight.m.ringlet.net> <5C40F611-22EB-49E4-8925-37922E771C0F@gmail.com> <20140828133846.GB2385@straylight.m.ringlet.net> <E02AE8AA-0974-42C6-AC83-C257DAFE329A@gmail.com> <B6FE2E90-A51B-4ABF-97E2-29881215F95F@gmail.com> <20140828142147.GA2200@straylight.m.ringlet.net> <34BC8621-2628-4FD1-9F58-A282B3A96C50@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Chenguang Li <horus.li@gmail.com> writes:

> Peter Pentchev <roam@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44zjeoejtl.fsf>