Re: Geometrically distributed random numbers on Rabbit 2000.
- From: Jonathan Kirwan <jkirwan@xxxxxxxxxxxxxx>
- Date: Wed, 08 Jun 2005 16:59:01 GMT
On Wed, 08 Jun 2005 23:18:30 +1000, The Real Andy
<will_get_back_to_you_on_This> wrote:
><snip>
>The knuth algorith I have mentioned is for a uniformly distributed
>RNG. It was already approved by the government regulator for use in
>gaming applications, hence the reason for using it.
If you test the algorithm that Westhues and I mention, note that I did
NOT copy it correctly from the book and he did. I had glanced
casually at the marks and misread the bars there. So use the CEIL
function he mentions, though it may work similarly either way (I've
not thought it through.)
Otherwise, the algorithm mentioned in the exercise I pointed out is
quite simple. You imagine a circle centered inside a square and sized
so that it just touches the sides of the square. Then select only
quadrant 1 to work with and ignore the rest. Then imagine two uniform
deviates from 0 to 1, with one of them taken as the x-axis and the
other as the y-axis. Then:
(1) get two random uniform deviates U and V,
(2) if U^2+V^2 >= 1 then goto 1, else X is set to U.
The number of executions of step 2 has the geometric distribution.,
with a minimum of 1 time, an average of 4/PI times, a maximum of
infinity, and a deviation of (4/PI)*(SQRT(1-PI/4).
Get the book.
Jon
.
- References:
- Geometrically distributed random numbers on Rabbit 2000.
- From: The Real Andy
- Re: Geometrically distributed random numbers on Rabbit 2000.
- From: The Real Andy
- Re: Geometrically distributed random numbers on Rabbit 2000.
- From: Jonathan Kirwan
- Re: Geometrically distributed random numbers on Rabbit 2000.
- From: The Real Andy
- Geometrically distributed random numbers on Rabbit 2000.
- Prev by Date: Re: OT: OS!? - Rant
- Next by Date: Re: Alternative clock display
- Previous by thread: Re: Geometrically distributed random numbers on Rabbit 2000.
- Next by thread: Re: Geometrically distributed random numbers on Rabbit 2000.
- Index(es):
Relevant Pages
|