The Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » sci.math.* » sci.math

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Phil Carmody

Posts: 2,219
Registered: 12/7/04
Re: Random numbers
Posted: Dec 21, 2007 9:38 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

quasi <quasi@null.set> writes:
> On 21 Dec 2007 16:16:52 +0200, Phil Carmody
> <thefatphil_demunged@yahoo.co.uk> wrote:
>

> >quasi <quasi@null.set> writes:
> >> On Fri, 21 Dec 2007 07:43:48 -0500, quasi <quasi@null.set> wrote:
> >>

> >> >On 21 Dec 2007 14:33:08 +0200, Phil Carmody
> >> ><thefatphil_demunged@yahoo.co.uk> wrote:
> >> >

> >> >>John <iamachamp@gmail.com> writes:
> >> >>> 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.

> >> >>
> >> >>int rand1to7i()
> >> >>{
> >> >> int r1=rand1to5i();
> >> >> if(r1==5) { r1+=rand1to5i()/2; }
> >> >> return r1;
> >> >>}

> >> >
> >> >Fatally flawed.
> >> >

> >> >>double rand1to7d()
> >> >>{
> >> >> return rand1to5d()+(rand1to5d()-1)/2;
> >> >>}

> >> >
> >> >Inefficient -- uses 2 RNG calls, instead of 1.

> >>
> >> Forget inefficiency -- it's worse than that.
> >>
> >> It's biased.

> >
> >Since when what being unbiased in the requirements?

>
> Don't be ridiculous.
>
> Unbiased was surely implied.
>

> >> >>> 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.

> >
> >I'm really trying hard, but I just can't see any mention
> >of the required distribution at all. Can you?

>
> If that was the case, then your method is even more inefficient.
>
> A simpler method for both the real case and the integer case would be
> to always return the number 3. Alternatively, call the random number
> generator for the range 1 to 5 and return _that_ value.
>
> Of course it was implicit in the problem that unbiased results were
> required.
>
> For the case of reals, you wouldn't have talked about gaps if you
> weren't trying to avoid lack of uniformity.
>

> >Please get your argument straight before posting nonsense to
> >Usenet, I always do.

>
> Your current response is cop-out, and you know it.


My "current" response? I can assure you I've not changed
what I've said since the very beginning.

> Admit your errors, don't try to obscure them -- that would show some
> integrity.


I don't think you'd recognise integrity if it were inserted
in additional headers in my posts.

Phil
--
Dear aunt, let's set so double the killer delete select all.
-- Microsoft voice recognition live demonstration


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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.