Re: Shock: rand function is not uniform!
[email protected] (Nicholas Clark) Mon, 18 Feb 2002 18:05:55 +0000
| Newsgroups | perl.riscos |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Feb 18, 2002 at 05:49:15PM +0000, James Taylor wrote: > On Mon 18 Feb, Nicholas Clark wrote: > > > > My general understanding about random numbers on computers > > is that the question to ask is 'well, how "random" do you > > want it?' in that it's very hard for an essentially > > non-random machine to fake "random" numbers for you; > > Thank you Nick, but I really don't think this is an issue with > pseudo random number generators per se, it appears to be a bug > in the *particular* rand function used by RISC OS Perl. Ah right. They are not something I know much about. (That previous message had about my sum total of knowledge about them. I don't know how to perform the statistical tests one uses to check them) > I noticed that the copy of UnixLib you have on your website > provides a rand function. I can't think why you would choose > to use that rand function instead of the standard one provided > by C but if you did then maybe the problem lies there. I didn't choose consciously. It was the one already in UnixLib. As to why whoever put that one there chose it, I don't know. As far as porting 5.004 and 5.005 went, if it compiled, linked and passed both perl's regression tests and whatever I was trying to do at the time, then I didn't bother investigating things. There were (and still are) enough things that I know don't work well that were already clear in their demands for attention. > PS. Who maintains UnixLib anyway, and where can I get hold > of the latest version? I think http://hard-mofo.dsvr.net/unixlib/ is reasonably up to date. There's a fairly active mailing list on current RISC OS gcc and unixlib, posting address gcc(guess what char goes here!)hard-mofo.dsvr.net I've not investigated the current version, and have no idea if it's still using the same rand() function. If you're able to provide a better function for UnixLib that meets the licensing terms (not sure what they are either) I'd be very surprised if Nick Burrett wasn't happy to replace the duff rand() Nicholas Clark -- EMCFT http://www.ccl4.org/~nick/CV.html