Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Feb 2003 15:00:14 -0800
From:      David Schultz <dschultz@uclink.Berkeley.EDU>
To:        Bakul Shah <bakul@bitblocks.com>
Cc:        phk@FreeBSD.ORG, "Andrey A. Chernov" <ache@nagual.pp.ru>, Mark Murray <mark@grondar.org>, Doug Barton <DougB@FreeBSD.ORG>, Kris Kennaway <kris@obsecurity.org>, current@FreeBSD.ORG
Subject:   Re: rand() is broken
Message-ID:  <20030202230014.GA44914@HAL9000.homeunix.com>
In-Reply-To: <200302021907.OAA04015@agamemnon.cnchost.com>
References:  <31532.1044211424@critter.freebsd.dk> <200302021907.OAA04015@agamemnon.cnchost.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake Bakul Shah <bakul@bitblocks.com>:
> > As I said, I don't know how big a concern this is.  But last time
> > it was enough of a concern to make us keep rand() as it was.
> 
> [I know you are talking about rand() but Mark Murray's
> earlier email about wanting to re-implement random() really
> concerned me so I want to make sure my point gets across]
> 
> Not changing random() was of real concern to me when I was
> doing chip simulations.  ASIC design verification folks won't
> be happy if the rug is pulled out from under them.  In
> general crypto and simulation needs are different and I don't
> trust the crypto guys to look out for the simulation guys!
> 
> I don't care any more if rand() is changed but _please_ leave
> random() alone!  And it would be nice to indicate *why* in
> the source code for the next time this discussion comes up.

If you need guaranteed reproducible random numbers that won't
change from system to system or across libc versions, you need to
roll your own PRNG.  A simple linear congruential generator such
as the original BSD algorithm might look random enough for your
purposes.  But I must admit that I was surprised when Andrey
Chernov pointed out that rand() had been replaced between -CURRENT
and -STABLE; I thought it was simply common knowledge that rand()
was broken, and nobody was interested in fixing it.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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