Date: Tue, 27 Feb 2001 12:57:58 -0500 From: Garance A Drosihn <drosih@rpi.edu> To: Kris Kennaway <kris@FreeBSD.ORG>, Terry Lambert <tlambert@primenet.com> Cc: "Jacques A. Vidrine" <n@nectar.com>, Kris Kennaway <kris@FreeBSD.ORG>, arch@FreeBSD.ORG Subject: Re: cvs commit: ports/astro/xglobe/files patch-random Message-ID: <p05010403b6c192466cbc@[128.113.24.47]> In-Reply-To: <20010226204224.A91585@citusc17.usc.edu> References: <20010226090108.C42108@spawn.nectar.com> <200102270310.UAA09594@usr05.primenet.com> <20010226204224.A91585@citusc17.usc.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
At 8:42 PM -0800 2/26/01, Kris Kennaway wrote: >On Tue, Feb 27, 2001 at 03:10:31AM +0000, Terry Lambert wrote: > > I am a scientist. Repeatability of experiments is important. > >As as scientist, you naturally care about your PRNG giving good >statistical randomness, so you don't get skewed results from your >simulation. It depends on what you are using rand() for. >rand() does not appear to give statistically random output - in >fact, visual inspection shows it to be patterned. As a good >scientist, you did TEST the properties of your PRNG before using >it as the foundation for your simulations, didn't you? There are plenty of good scientists at RPI. One of them on the same floor as me once spent WEEKS testing various pseudo-random algorithms to be sure the results were statistically random based on a variety of different criteria. He found one method that worked, and used that for the simulations where he needed that level of truly-random output. That does not mean he never uses rand(). It just depends on what the project is, and the reason you want a random bunch of numbers. Sometimes you DO want the same random numbers between multiple platforms, because you are trying to benchmark the platform, and not solve some statistical analysis. >By fixing the algorithm, we are preventing future generations >of scientists from making the same mistake, and thereby ensuring >that FreeBSD used as a research platform gives good science, not >bad science. Our children and children's children will thank us! >Onward, mighty FreeBSD, platform for the future!! There is a simple solution for this concern. It is called "the man page". Leave rand() alone, and simply document it's limitations. The man page already explicitly says: "rand, srand, rand_r - bad random number generator" and "These interfaces are obsoleted by random(3)" In my book, that means anyone interested in "true statistical randomness" has already been given a pretty clear warning. random(3) claims to have appeared in 4.2bsd (1993?), so people have had plenty of time change to a much better algorithm IF THEY NEED statistical randomness. Me, I don't do much with random numbers, so I don't really have a strong feeling if whether rand() should be changed. However, my gut feeling is that Terry's argument is valid, and we can address your valid concern without disrupting people who are using rand() for reasons different than what you are assuming they are using it for. Admittedly the standards I have seen for rand state that different implementations of rand MAY produce different sequences for a given seed. That does not mean that they MUST, and I don't see much advantage in changing rand() at this point in time, when there are already so many superior random-number generating routines defined. If you DO want to change rand(), then at least try to change it to match a "superior rand implementation" on some other platform, and don't just pull some brand new strategy out of thin air. People apparently recognized that rand() was not statistically random back in 1993, and yet they fixed that by providing a new routine instead of altering the current one. I see no reason to "fix" it now. So I say, leave the algorithm alone. The proper fix to the original bikeshed is to just change xglobe to stop using rand, if it really bothers people that much. -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05010403b6c192466cbc>