Date: Wed, 19 Feb 2003 10:43:08 +0100 From: Dag-Erling Smorgrav <des@ofug.org> To: phk@phk.freebsd.dk Cc: Paul Herman <pherman@frenchfries.net>, Peter Jeremy <peterjeremy@optushome.com.au>, FreeBSD Hackers <hackers@FreeBSD.ORG> Subject: Re: arc4random() range Message-ID: <xzpsmukwqqb.fsf@flood.ping.uio.no> In-Reply-To: <86890.1045646060@critter.freebsd.dk> (phk@phk.freebsd.dk's message of "Wed, 19 Feb 2003 10:14:20 %2B0100") References: <86890.1045646060@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
phk@phk.freebsd.dk writes: > Well, I'm right in principle but wrong in current practice, at > the very least make it: > > #define arc4random31() (arc4random() & RAND_MAX) or rather #define arc4random31() (arc4random() % (RAND_MAX + 1)) to avoid relying on RAND_MAX being one less than a power of two. DES -- Dag-Erling Smorgrav - des@ofug.org 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?xzpsmukwqqb.fsf>