comp.lang.ada
 help / color / mirror / Atom feed
From: Natasha Kerensikova <lithiumcat@instinctive.eu>
Subject: Re: Lotto simulation
Date: Mon, 16 Jun 2014 14:13:19 +0000 (UTC)
Date: 2014-06-16T14:13:19+00:00	[thread overview]
Message-ID: <slrnlpturs.i0l.lithiumcat@nat.rebma.instinctive.eu> (raw)
In-Reply-To: lnms40$gqa$1@dont-email.me

On 2014-06-16, J-P. Rosen <rosen@adalog.fr> wrote:
> Le 16/06/2014 13:15, Stefan.Lucks@uni-weimar.de a écrit :
>> Well, do you think the Annotated Reference Manual
>> <http://www.ada-auth.org/standards/12aarm/html/AA-A-5-2.html> needs a
>> clarification? It explicitely tells
>> 
>>   A sufficiently long sequence of random numbers obtained by successive
>>   calls to Random is approximately uniformly distributed over the range of
>>   the result subtype.
>
> OK, maybe it's another issue, and it's not my domain of knowledge. But I
> certainly remember that the decision to provide separate discrete and
> floating generators was deliberate and for good reasons. Maybe Randy
> remembers where the discussions were archived?
>
I would guess this is the same problem as going from a stream of random
bits to a discrete generator: you can use the random stream to fill bits
after a zero integral part and get 2^N uniformly-spread floating point
value.

However if you have a non-power-of-two discrete type, a simple
pigeonhole argument shows that the generator would be skewed towards
some values. For example using 3 random bits and applying a modulus to
choose between a 7-value enumeration would make the first value twice as
likely as the others. Using more random bits would of course lower the
bias, but it would never reach zero.

If random floating-point are generated using the simple algorithm above,
the bias is exactly the same, only distributed among different values.
More elaborate floating-point generator might lead to a different
distribution, or maybe even different total bias values, but you can't
get a zero-bias unless you use specific algorithms that tap directly
into the source random stream.


Hoping this helps,
Natasha


  reply	other threads:[~2014-06-16 14:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-15 17:07 Lotto simulation montgrimpulo
2014-06-15 18:54 ` Stefan.Lucks
2014-06-15 19:53   ` J-P. Rosen
2014-06-16  5:25     ` Stefan.Lucks
2014-06-16  7:49       ` J-P. Rosen
2014-06-16 11:15         ` Stefan.Lucks
2014-06-16 13:40           ` J-P. Rosen
2014-06-16 14:13             ` Natasha Kerensikova [this message]
2014-06-16 17:51             ` Randy Brukardt
2014-06-15 19:56 ` Denis McMahon
2014-06-15 20:10 ` Dirk Heinrichs
2014-06-15 20:43   ` Simon Wright
2014-06-16 20:22     ` Dirk Heinrichs
2014-06-15 20:54 ` Simon Wright
2014-06-15 22:09 ` Jeffrey Carter
2014-06-16 11:40 ` Markus Schöpflin
2014-06-16 14:25   ` Jacob Sparre Andersen
2014-06-16 12:02 ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox