From owner-cvs-all Tue Apr 24 11: 8:42 2001 Delivered-To: cvs-all@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id ACA9D37B422; Tue, 24 Apr 2001 11:08:36 -0700 (PDT) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.11.3/8.11.3) id f3OI8T285690; Tue, 24 Apr 2001 22:08:29 +0400 (MSD) (envelope-from ache) Date: Tue, 24 Apr 2001 22:08:27 +0400 From: "Andrey A. Chernov" To: Garrett Wollman 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> References: <200104230229.f3N2TA082491@freefall.freebsd.org> <200104241743.NAA97478@khavrinen.lcs.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i 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 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Apr 24, 2001 at 13:43:33 -0400, Garrett Wollman wrote: > < 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