Date: Tue, 24 Apr 2001 22:08:27 +0400 From: "Andrey A. Chernov" <ache@nagual.pp.ru> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libc/stdlib rand.3 rand.c Message-ID: <20010424220826.A85409@nagual.pp.ru> In-Reply-To: <200104241743.NAA97478@khavrinen.lcs.mit.edu>; from wollman@khavrinen.lcs.mit.edu on Tue, Apr 24, 2001 at 01:43:33PM -0400 References: <200104230229.f3N2TA082491@freefall.freebsd.org> <200104241743.NAA97478@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 24, 2001 at 13:43:33 -0400, Garrett Wollman wrote: > <<On Sun, 22 Apr 2001 19:29:10 -0700 (PDT), "Andrey A. Chernov" <ache@FreeBSD.org> said: > > > Add sranddev() since srand() is not vary much with seed, typical time > > This seems utterly pointless to me. The only reason that any program > would use rand()/srand() is because those are the official interfaces > specified in ISO 9899. No program would ever use an sranddev() > interface; if strict ISO 9899 conformance is not necessary, a better > PRNG (such as random() or arc4random()) would have been used. 1) It is useful for quick-fix 3rd-party programs without complex patches replacing with random() or arc4random(). 2) Now rand() family mirrors functionality of all random() family functions. 3) In its current form rand() can be used even without replacing with random() because now its distributions is much better, the only problem is that with small seeding delta first value differs very little. Adding sranddev() solve this problem for 3rd-party programs which needs only _one_ random value and call srand(time(0)). Calling srandom() for only one random value is slow, rand() is faster here. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010424220826.A85409>