comp.lang.ada
 help / color / mirror / Atom feed
From: Stefan.Lucks@uni-weimar.de
Subject: Re: Lotto simulation
Date: Mon, 16 Jun 2014 07:25:10 +0200
Date: 2014-06-16T07:25:10+02:00	[thread overview]
Message-ID: <alpine.DEB.2.10.1406160715490.4637@debian> (raw)
In-Reply-To: <lnktj7$gp$1@dont-email.me>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1685 bytes --]

On Sun, 15 Jun 2014, J-P. Rosen wrote:

> Le 15/06/2014 20:54, Stefan.Lucks@uni-weimar.de a écrit :
>> The alternative is to (2n) instantiate a single random generator (I've
>> forgotten the package name, but it is not A.N.Discrete_Random), which
>> just generates a Float F_Rand between 0 and 1. Then set R_I :=
>> Truncate(1 + F_Rand * (50-I)).
> This is not equivalent. I don't remember the details, but in the making
> of Ada 95 there was a furious discussion between numericists about
> whether it was possible to make a discrete random generator given a
> floating point random generator.
>
> After megabytes of E-mail discussion, they concluded that NO, it was not
> possible, and therefore that Ada should have both.

I am not aware of that discussion, but mathematically, given a uniformly 
distributed real number F between 0.0 and 1.0, one can get a uniformly 
distributed discrete D between Low and high: D := Truncate(Low + F * 
(High-Low + 1)).

I guess, the issue that has been raised in that discussion that if F is of 
type float or even double-float, it has a mantissa of limited size, and 
then the distribution of D would significantly deviate from the uniform 
distribution if High-Low happens to be large. In the current case, 
however, High-Low < 50, so the solution using the uniformly distributed 
float should work properly. If D would significantly deviate from the 
uniform distribution, then so would F.



------  I  love  the  taste  of  Cryptanalysis  in  the morning!  ------
     <http://www.uni-weimar.de/cms/medien/mediensicherheit/home.html>
--Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universität Weimar, Germany--

  reply	other threads:[~2014-06-16  5:25 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 [this message]
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
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