🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #23228

Re: Misuse of random number generators

#23228
From: William H. Jefferys
Date: Thu, 31 Dec 1987 21:52
19 lines
1249 bytes
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
Technical Details
Message-ID: <2343@utastro.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!ut-sally!utastro!bill
References: <2337@utastro.UUCP> <6418@jade.BERKELEY.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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