From owner-freebsd-current Sun Feb 2 15: 0:19 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 501FA37B401; Sun, 2 Feb 2003 15:00:18 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8DCDA43F75; Sun, 2 Feb 2003 15:00:17 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h12N0FNt046584; Sun, 2 Feb 2003 15:00:15 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h12N0E1x046583; Sun, 2 Feb 2003 15:00:14 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Sun, 2 Feb 2003 15:00:14 -0800 From: David Schultz To: Bakul Shah Cc: phk@FreeBSD.ORG, "Andrey A. Chernov" , Mark Murray , Doug Barton , Kris Kennaway , current@FreeBSD.ORG Subject: Re: rand() is broken Message-ID: <20030202230014.GA44914@HAL9000.homeunix.com> Mail-Followup-To: Bakul Shah , phk@FreeBSD.ORG, "Andrey A. Chernov" , Mark Murray , Doug Barton , Kris Kennaway , current@FreeBSD.ORG References: <31532.1044211424@critter.freebsd.dk> <200302021907.OAA04015@agamemnon.cnchost.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200302021907.OAA04015@agamemnon.cnchost.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake Bakul Shah : > > 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