Date: Sun, 02 Feb 2003 10:48:00 -0800 From: Bakul Shah <bakul@bitblocks.com> To: Mark Murray <mark@grondar.org> Cc: "Jeroen C. van Gelderen" <jeroen@vangelderen.org>, phk@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: rand() is broken Message-ID: <200302021848.NAA19508@agamemnon.cnchost.com> In-Reply-To: Your message of "Sun, 02 Feb 2003 15:32:32 GMT." <200302021532.h12FWWaX047973@grimreaper.grondar.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> Good point. We can re-implement random() internally with arc4rand(). > > Objections? Guys, please realize that random() is also used in generating simulation inputs (or timing or whatever). If you go change the underlying algorithm or its parameters one can't generate the same sequence from the same seed when repeating a test. Some chip bug symptoms show up after hours/days of simulation time and only with specific inputs so repeatablity is a requirement. The old 16 bit rand() was broken enough that it didn't matter much (read: _I_ don't care) if its behavior got changed but random() has a pretty long cycle and enough "randomness" to be very useful and it *is* used. *Please* don't change random() -- if you do that you will break existing tests. It is not a matter of just rewriting tests since there is no easy way to predict which input triggers a certain bug -- one can try to use the same binaries but that prevents fixing of bugs in the test generation code itself. If you think random() is not random enough for your purposes, go create a new function with a *new* name. [I see from his latest email that PHK remembered the old discussion!] -- bakul 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?200302021848.NAA19508>