--- In [email protected], "suchismit mahapatra" <[EMAIL PROTECTED]> wrote:
>
> sorry sires
> couldnt reply earlier, was caught up with something.

Not that I'm surprised by this; this is my permanent condition, and I
know that I'm not the only one. ;-)

> 1) Invoke r5g(); if the number is 4, go back to step 1
>    immediately.
> 2) In case of 0 or 1, set the "Base" to 0, otherwise set
>    the "Base" to 4.
> 3) Invoke r5g() another time; if the result is 4, go back
>    to step 1 immediately.
> 4) Add the number from step 3 to the "Base" from step 2.
> 5) If the result is 7, go back to step 1 immediately.
> 
> sir nico
> could u please clarify step 5?
> why have u chosen such an algorithm?
> what really fuelled this "approach"?
> pretty abstract innovative thinking :)
> please give me some time to analyze this and come up with
> stats about the distribution generated using this algorithm.
> 
> ummm
> about why i wanted to create a random 7 generator from a
> random 5 generator. no reasons as such. this "problem" just
> came up while i was studying random algorithms.
> thought lets try.
<snip>

Step 5 has one simple reason: you want to generate numbers in the
range 0-6, not 0-7; as steps 1 through 4 might give you a 7 you will
want to discard this number which simply wouldn't fit your
requirements. That's the reason for this step.

Why have I chosen such an algorithm? Well, basically because it was
the first idea that came to my mind when reading your question. :-)

I am very happy to see that this question came up utterly due to
curiosity. This is one of the two best motivators I've ever
experienced, the other one is pure necessity; need and interest are
the best teachers in my opinion.

Have fun, and I hope you'll have some more such nice questions.

Cheers,
Nico

Reply via email to