Path: utzoo!mnetor!uunet!husc6!ut-sally!utastro!bill From: bill@utastro.UUCP (William H. Jefferys) Newsgroups: comp.sys.mac Subject: Re: Misuse of random number generators Message-ID: <2343@utastro.UUCP> Date: 31 Dec 87 21:52:48 GMT References: <2337@utastro.UUCP> <6418@jade.BERKELEY.EDU> Reply-To: bill@astro.UUCP (William H. Jefferys) Organization: UT AUSTIN Astronomy Department/McDonald Observatory Lines: 19 Keywords: random numbers, multiplicative congruential generators In article <6418@jade.BERKELEY.EDU> jmm@thoth8.berkeley.edu.BERKELEY.EDU () writes: ~If this is true, what's the best way to get random numbers in the range ~1..6? (I'm using LSPascal.) ~ Use a linear transformation. If the built-in RNG gives numbers distributed uniformly on [x0,x1] and you want them distributed uniformly on [y0,y1] then let y := (x - x0)*(y1 - y0)/(x1 - x0) + y0; The special case when y0 = 0, y1 = 1 is particularly useful since this is the usual starting point for obtaining other distributions (e.g., Gaussian, Poisson, ...) Bill Jefferys -- Glend. I can call spirits from the vasty deep. Hot. Why, so can I, or so can any man; But will they come when you do call for them? -- Henry IV Pt. I, III, i, 53