Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!apple!agate!shelby!neon!kaufman From: kaufman@Neon.Stanford.EDU (Marc T. Kaufman) Newsgroups: comp.sys.mac.programmer Subject: Re: Is Random() random? Message-ID: <1990Dec5.071950.9481@Neon.Stanford.EDU> Date: 5 Dec 90 07:19:50 GMT References: <31359.275BAB9A@stjhmc.fidonet.org> <47094@apple.Apple.COM> Organization: Computer Science Department, Stanford University Lines: 20 In article <47094@apple.Apple.COM> lins@Apple.COM (Chuck Lins) writes: >In article <31359.275BAB9A@stjhmc.fidonet.org> Chris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) writes: ->> how random is the Toolbox routine Random()? IM-I says it returns ->> an integer in the range -32767 (not -32768) to 32,767 before ->> cycling. does this mean it will hit every number in that range ->> once before repeating? and why the seemingly strange range ->It definately won't hit every number once before repeating. >And if it did hit every number in the range before repeating it wouldn't be >random. It isn't random. Its pseudo-random. A previous poster suggested looking at the seed value, which is 32 bits. In 32-bit space, Random() hits 2^31 -2 values before repeating. The lower 16 bits do not cycle through all values before repeating. In fact, I don't really know what the statistical properties of the lower 16-bits of Random() are. Has anyone looked at it? It should be OK for uniform distribution, at least. Marc Kaufman (kaufman@Neon.stanford.edu)