From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 28 15:05:23 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C8372D97 for ; Thu, 28 Aug 2014 15:05:23 +0000 (UTC) Received: from be-well.ilk.org (be-well.ilk.org [23.30.133.173]) by mx1.freebsd.org (Postfix) with ESMTP id 9B526125A for ; Thu, 28 Aug 2014 15:05:23 +0000 (UTC) Received: from lowell-desk.lan (lowell-desk.lan [172.30.250.41]) by be-well.ilk.org (Postfix) with ESMTP id 2A01933C1E for ; Thu, 28 Aug 2014 11:05:12 -0400 (EDT) Received: by lowell-desk.lan (Postfix, from userid 1147) id CE11839860; Thu, 28 Aug 2014 11:05:10 -0400 (EDT) From: Lowell Gilbert To: freebsd-hackers@freebsd.org Subject: Re: On changing rand(3) to random(3) in awk(1) References: <53FEFBB8.5040305@gmail.com> <20140828131526.GA2385@straylight.m.ringlet.net> <5C40F611-22EB-49E4-8925-37922E771C0F@gmail.com> <20140828133846.GB2385@straylight.m.ringlet.net> <20140828142147.GA2200@straylight.m.ringlet.net> <34BC8621-2628-4FD1-9F58-A282B3A96C50@gmail.com> Date: Thu, 28 Aug 2014 11:05:10 -0400 In-Reply-To: <34BC8621-2628-4FD1-9F58-A282B3A96C50@gmail.com> (Chenguang Li's message of "Thu, 28 Aug 2014 22:33:43 +0800") Message-ID: <44zjeoejtl.fsf@lowell-desk.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2014 15:05:23 -0000 Chenguang Li writes: > Peter Pentchev 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.