Re: Random numbers



On Dec 21, 3:16 am, John <iamach...@xxxxxxxxx> wrote:
Given a function that returns a random number between 1-5, write one
that returns a random number between 1-7 for the case when it should
be integer and for the case it can be real.

Let S be the function that generates a RN between 1 and 5. Then

T = S_1 + S_2 + ... + S_7

For the reals , RN_7 = T/7
For intgers, RN_7 = T mod 7

Bill J
.