Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Random numbers
Replies: 64   Last Post: Dec 24, 2007 1:04 PM

 Messages: [ Previous | Next ]
 quasi Posts: 12,067 Registered: 7/15/05
Re: Random numbers
Posted: Dec 23, 2007 9:33 PM

On Sun, 23 Dec 2007 16:06:30 -0800 (PST), bill <b92057@yahoo.com>
wrote:

>On Dec 22, 5:25 pm, quasi <qu...@null.set> wrote:
>> On Sat, 22 Dec 2007 16:30:20 -0800 (PST), bill <b92...@yahoo.com>
>> wrote:

>> >
>> >On Dec 22, 10:16 am, quasi <qu...@null.set> wrote:

>> >> On Fri, 21 Dec 2007 10:57:00 -0800 (PST), simple.pop...@gmail.com
>> >> wrote:

>>
>> >> >On Dec 21, 11:37 pm, bill <b92...@yahoo.com> wrote:
>> >> >> On Dec 21, 3:16 am, John <iamach...@gmail.com> 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
>>
>> >> >May be this should fix it:
>>
>> >> >For the reals , RN_7 = 1 + (T-7)*3/14
>>
>> >> Yes, that fixes the range.
>>
>> >> But it's still biased (that is, not a unform distribution).
>>
>> >> quasi
>>
>> >The OP does not specify a uniform
>> >distribution, merely the range.

>>
>> This has already been discussed.
>>
>> The obvious assumption _implicit_ in the problem, even if not unstated
>> is that the resulting distribution should be uniform. Of course, it
>> should have been specified, but common sense dictates that in the
>> absence of the required info, to choose the natural default.
>>
>> If there was no preference for a distribution, there would be no need
>> to use the RNG provided for the range 1 to 5. We could just always
>> produce the number 3, for example. In other words, the very fact that
>> an RNG for the range 1 to 5 was given as part of the problem makes it
>> clear that the for the actual problem (not the OP's deficient
>> statement of it), it almost certainly _was_ specified that the
>> required distribution should be uniform.
>>

>> >RN_7 = T/7 satisfies the range 1 thru 7.
>>
>> So what? It's badly biased. Worse, since there is no discussion of
>> bias or the lack of it, it's misleading to those unaware of the issue.
>>

>> >T/7 is a numner in the range 1 thru 7,
>> >but is it random?

>>
>> Ok, but note that T/7 never exceeds 5.
>>
>> It's definitely not uniformly random.
>>

>> >If RN_7 = T mod 7 +1, the probability
>> >of a correct guess is 1/7

>>
>> Nonsense. Do a simulation.
>>

>> >If RN_7 = T/7, the probability
>> >of a correct guess is < .11 if you always
>> >guess that T = 21 or 22

>>
>> If the original RNG is uniformly distributed on the interval (1,5),
>> then it's a continuous distribution, so the probability that T = 21 or
>> T = 22 is 0.

>
>That makes it even harder to guess correctly if you have to be exact.
>

>> And once again, since T/7 only has range 1 to 5, thus it's obviously
>> not uniform on (1,7). It's not even uniform on (1,5), since it has
>> more concentration near the mean (3) than near the ends.
>>
>> quasi

>
>Assume that RNG_5 is continuous in the interval 1 - 5
>and 0 elsewhere. Let X_i be a number generated by RNG_5.
>Then Y_i = 1.5 * (X_i) - 0.5 is continuous in the interval 1 - 7
>and 0 elsewhere.

Yes, and Y is uniform if X is.

The problem with your previously proposed RNGs was the dependence on
the variable T. But T is not even close to uniform, being biased
towards its mean, and away from the ends. Of the RNGs proposed in this
thread, all of those which were based on T were biased, and badly so.

>That is, unless there are more points between 1 and 7 than there are
>between 1 and 5?

Well, that's the "gaps" issue, relating to the fact that a
"continuous" _pseudorandom_ number generator is actually only
_pretending_ to be continuous. In reality, it's discrete. But if we
are just discussing theoretical random number generators, that issue
doesn't come into play.

quasi

Date Subject Author
12/21/07 Champ
12/21/07 quasi
12/21/07 quasi
12/21/07 Phil Carmody
12/21/07 quasi
12/21/07 quasi
12/21/07 Phil Carmody
12/21/07 quasi
12/21/07 Phil Carmody
12/21/07 Phil Carmody
12/21/07 quasi
12/21/07 quasi
12/21/07 Phil Carmody
12/21/07 quasi
12/21/07 Phil Carmody
12/21/07 Phil Carmody
12/21/07 quasi
12/21/07 Phil Carmody
12/21/07 quasi
12/21/07 Marshall
12/21/07 Phil Carmody
12/21/07 quasi
12/21/07 Phil Carmody
12/21/07 Marshall
12/21/07 briggs@encompasserve.org
12/21/07 William Elliot
12/21/07 quasi
12/22/07 William Elliot
12/21/07 Pubkeybreaker
12/21/07 b92057@yahoo.com
12/22/07 quasi
12/21/07 simple.popeye@gmail.com
12/21/07 simple.popeye@gmail.com
12/22/07 quasi
12/22/07 Gib Bogle
12/22/07 quasi
12/21/07 Marshall
12/22/07 simple.popeye@gmail.com
12/22/07 quasi
12/22/07 simple.popeye@gmail.com
12/22/07 quasi
12/22/07 quasi
12/22/07 quasi
12/22/07 simple.popeye@gmail.com
12/22/07 quasi
12/23/07 simple.popeye@gmail.com
12/23/07 simple.popeye@gmail.com
12/23/07 simple.popeye@gmail.com
12/23/07 simple.popeye@gmail.com
12/23/07 simple.popeye@gmail.com
12/22/07 simple.popeye@gmail.com
12/22/07 Herman Rubin
12/22/07 b92057@yahoo.com
12/22/07 quasi
12/23/07 b92057@yahoo.com
12/23/07 quasi
12/23/07 b92057@yahoo.com
12/24/07 quasi
12/24/07 quasi