Date: Wed, 19 Feb 2003 09:22:49 +0100 From: phk@phk.freebsd.dk To: Paul Herman <pherman@frenchfries.net> Cc: Peter Jeremy <peterjeremy@optushome.com.au>, FreeBSD Hackers <hackers@FreeBSD.ORG> Subject: Re: arc4random() range Message-ID: <77946.1045642969@critter.freebsd.dk> In-Reply-To: Your message of "Wed, 19 Feb 2003 00:16:57 PST." <20030218232210.T240-100000@mammoth.eat.frenchfries.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <20030218232210.T240-100000@mammoth.eat.frenchfries.net>, Paul Herma n writes: > arc4random() returns random numbers in the range of 0 to > (2**32)-1, and therefore has twice the range of RAND_MAX. Good. > EXAMPLES > The following produces a drop-in replacement for the traditional > random() and rand() functions using arc4random(): > #define arc4random31() (arc4random() & 0x7FFFFFFF) Not good. Only true on 32 bit archs. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?77946.1045642969>