[net.puzzle] random number wanted between neg inf and pos inf

osman@sprite.DEC (Eric, DIGITAL, Burlington Ma. 617 273-7484) (12/17/85)

>> >    Now he tells us that it's got to be uniformly distributed?  If such
>> >a function exists, the probability of it generating a number between any
>> >two arbitrarily large, but finite limits is exactly 0!  Why would
>> >anyone want a random number generator like that?
>> Not zero, since the random number generator will in fact come up with a
>> number.  The chances are infinitesimal.  The difference is admittedly
>> very subtle.
>
>I haven't been able to market this, so here, ABSOLUTELY FREE, is my
>generator!  It's GUARANTEED to generate ALL positive integers with
>equal frequency, if you only run it long enough.
>
>
>               int rand() {
>                       return 6;
>               }
>--
>Col. G. L. Sicherman
>UU: ...{rocksvax|decvax}!sunybcs!colonel
>CS: colonel@buffalo-cs
>BI: csdsicher@sunyabva

I disagree that this one's output is evenly distributed.  There will be
a rather high spike at x=6.

I'm the original poser of the problem.  I'm surprised at the high
smart-ass/serious ratio on the responses.

The best I've thought of so far for a random number between neg inf and
pos inf is:

        f() = tan (rnd()*pi - pi/2)

In words, take a random number between 0 and 1, scale it to an angle
between -pi/2 and pi/2.  Then take the tangent.  Since tangent of such
angles ranges from -oo to oo, this produces a random number in desired
range.

However, I don't think this is evenly distributed.  (If not, what is
it's distribution ??)  Can we scale this function to make it evenly
distributed ?

/Eric

bhayes@glacier.ARPA (Barry Hayes) (12/17/85)

It may not make sense to talk about "choosing randomly" one of
an infinite number of possibilities.  Just watch...

Let's play a game.  I have, in this large and ornate paper bag,
an infinite number of poker chips.  Each poker chip has one integer
on each side, and, in fact, the two integers on any poker chip
differ by exactly one.  The game is played as follows:

1) I reach into the bag, and choose a random poker chip, without
   peeking at the chip.
2) I hold it between us so that I can see one side, and you can see
   the other, but neither of us sees both sides.
3) Either of us can reject the chip, just from seeing the side we see.
4) We bet some fixed amount.
5) The person with the low side wins.

The distribution of the chips is as follows:
Chip numbers     how many
1/2              1
2/3              2
3/4              4
4/5              8
and so on

I calculate the odds as follows:
If I see "1" on my chip [a very unlikely event] I must win.
For any other number [say "4"] there are twice as many chips which
will win for me [8 "4/5" chips] as will lose [4 "3/4" chips].  Therefore,
I should always bet, and I will win 2/3 of the time.

You of course can make the same calculations and will also win 2/3
of the time.

 -Barry "at no time do my fingers leave my hands" Hayes
  bhayes@glacier

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (12/18/85)

> I'm the original poser of the problem.  I'm surprised at the high
> smart-ass/serious ratio on the responses.

Anyone who asks for a generator of random numbers
uniformly distributed from -Infinity to +Infinity
deserves what he gets.

hes@ecsvax.UUCP (Henry Schaffer) (12/18/85)

> >> >    Now he tells us that it's got to be uniformly distributed?  If such
> >> >a function exists, the probability of it generating a number between any
> >> >two arbitrarily large, but finite limits is exactly 0!  Why would
> >> >anyone want a random number generator like that?
       This does make the correct point.  (discussed more below)
> >> Not zero, since the random number generator will in fact come up with a
> >> number.  The chances are infinitesimal.  The difference is admittedly
> >> very subtle.
       Even more subtle - since a probability of zero doesn't mean it
       can't happen!  
> > 
> >I haven't been able to market this, so here, ABSOLUTELY FREE, is my
> >generator!  It's GUARANTEED to generate ALL positive integers with
> >equal frequency, if you only run it long enough.
                                ^^^^^^^^^^^^^^^^^^
> > [generator omitted]
> >Col. G. L. Sicherman
    postnews should know when to append the :-) symbol :-)
> 
> I disagree that this one's output is evenly distributed.  There will be
> a rather high spike at x=6.
   you just didn't wait long enough :-)
> 
> I'm the original poser of the problem.  I'm surprised at the high
> smart-ass/serious ratio on the responses.
   you might have done better in net.math.stat than net.puzzle
> 
> The best I've thought of so far for a random number between neg inf and
> pos inf is: ...
   It is no problem to generate a random number between neg inf and pos inf.
   The normal distribution has these limits and therefore all you need is to
   generate a random number in [0,1] (uniform distribution) and apply a
   transformation.
> 
> However, I don't think this is evenly distributed.  (If not, what is
> it's distribution ??)  Can we scale this function to make it evenly
> distributed ?
> 
   Of course it's not evenly (uniformly) distributed.  A probability 
   distribution integrates to unity between its limits.  You are asking
   for a (non-negative) function which is of equal amplitude (uniform)
   between neg inf and pos inf and has a finite (unity) integral.
   Let's do this by taking limits:  A uniform distribution between -L/2
   and +L/2 has height 1/L, and one can generate a number from this 
   distribution by taking one from a uniform [0,1] (which is the usual
   one which random number generators named RAND approximate), subtracting
   1/2 and then multiplying by L.

   Now we have exactly what you want as we let L get larger and approach inf.
   We approach a uniform distribution of infinite width and zero height.
   In the limit, you have trouble since L becomes infinite and you have a
   step of multiplication by L in your generation.  However this is exactly
   what you want (since inf is not your usual kind of number) since nearly
   all (in the measure theory sense) of your distribution is out past any
   finite range you care to specify.  So the real question is why you want
   a random number generator which (except for a set of outcomes with measure
   zero) always gives an infinite result?

> /Eric
--henry schaffer  (feel free to use mail, if you'ld like to discuss this more)

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (12/21/85)

Henry gave a good explanation of the problem with this request.

One other noteworthy point is that such a generator is
virtually guaranteed to return a value that exceeds the storage
capacity of your computer the very first time it is invoked.
(I.e., such a generator is "not physically realizable".)

leeper@mtgzz.UUCP (m.r.leeper) (12/22/85)

> > I'm the original poser of the problem.  I'm surprised at the high
> > smart-ass/serious ratio on the responses.
> 
> Anyone who asks for a generator of random numbers
> uniformly distributed from -Infinity to +Infinity
> deserves what he gets.

Well someone should explain why it is impossible to have a uniform
distribution on a set of infinite measure.  One way to look at it is
that the highest number that any program on a real computer could give
you would be just too near to zero to be a realistic choice for the
random number generator you ask for.   Assume you have a uniform
distribution on -inf to +inf.   Let M be the largest finite number the
human mind has ever conceived.  The interval from -M to M is of finite
measure, that implies that the probability of the number picked at 
random (uniformly distributed on -inf to +inf) falling into this
interval is zero!  Certainly most (and that is putting it lightly) of
the numbers generated would fall outside of this interval.  That is
not a rigorous proof that you cannot uniformly distribute on a set of
infinite measure, but it should give you some idea that it would not
do you any good even if you could.

All numbers are small in magnitude.  On the real number line, the
human mind can conceive of only those numbers extremely close to zero,
so close to zero that if you were picking a real number at random
(uniformly distributed) the probability is zero that you would pick a
numbers with so small an absolute value.  We can conceive of the
boundries of the real number line and a tiny island of numbers in a
tiny neighborhood around zero.

				Mark Leeper
				...ihnp4!mtgzz!leeper

ags@pucc-h (Dave Seaman) (12/23/85)

A random variable is characterized by its distribution function.  If R
is the real number line, then a probability distribution is a function
F : R --> [0,1] with the properties

	(1) F is nondecreasing,

	(2) F is right-continuous (for our purposes we may as well
	    assume F is continuous),

	(3) F(x) --> 0 as x --> -infinity,

	(4) F(x) --> 1 as x --> +infinity.

F defines a probability measure on R such that F([a,b]) = F(b) - F(a).
For the distribution to be uniform on R, we have the added condition

	(5) F has constant slope on R.

Condition (5) is obviously incompatible with (3) and (4).  Therefore
there is no such thing as a uniform distribution on R.
-- 
Dave Seaman	  					pur-ee!pucc-h!ags

ags@pucc-h (Dave Seaman) (12/27/85)

In article <2492@glacier.ARPA> bhayes@glacier.UUCP (Barry Hayes) writes:
>It may not make sense to talk about "choosing randomly" one of
>an infinite number of possibilities.  Just watch...

Of course it makes sense to "choose randomly" one of an infinite number
of possibilities.  You seem to think that "choose randomly" means
"choose in such a way that all choices are equally likely," which
is another matter entirely.

>The distribution of the chips is as follows:
>Chip numbers     how many
>1/2              1
>2/3              2
>3/4              4
>4/5              8
>and so on
>
>I calculate the odds as follows:

Your calculation depends on the assumption that all chips are equally likely
to be chosen.  Very well:  what is the probability (p) that the 1/2 chip
will be chosen?  Whatever this probability is, the same probability must
apply to all the other chips, with the sum of all the probabilities being
one.  A moment's thought shows you cannot do it.

There are infinitely many ways to assign probabilities to this sample space,
but none of them are uniform.
-- 
Dave Seaman	  					pur-ee!pucc-h!ags