From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news-2.dfn.de!news.dfn.de!news.uni-weimar.de!medsec1.medien.uni-weimar.de!lucks From: Stefan.Lucks@uni-weimar.de Newsgroups: comp.lang.ada Subject: Re: Lotto simulation Date: Mon, 16 Jun 2014 07:25:10 +0200 Organization: Bauhaus-Universitaet Weimar Message-ID: References: <77cc4476-8c57-481b-afb9-8f53f8b16e37@googlegroups.com> NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-983179213-1402896310=:4637" X-Trace: pinkpiglet.scc.uni-weimar.de 1402896254 20677 141.54.178.228 (16 Jun 2014 05:24:14 GMT) X-Complaints-To: news@pinkpiglet.scc.uni-weimar.de NNTP-Posting-Date: Mon, 16 Jun 2014 05:24:14 +0000 (UTC) X-X-Sender: lucks@debian In-Reply-To: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) X-Original-Bytes: 3213 Xref: number.nntp.dca.giganews.com comp.lang.ada:186951 Date: 2014-06-16T07:25:10+02:00 List-Id: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-983179213-1402896310=:4637 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 15 Jun 2014, J-P. Rosen wrote: > Le 15/06/2014 20:54, Stefan.Lucks@uni-weimar.de a =E9crit : >> 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 :=3D >> 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=20 distributed real number F between 0.0 and 1.0, one can get a uniformly=20 distributed discrete D between Low and high: D :=3D Truncate(Low + F *=20 (High-Low + 1)). I guess, the issue that has been raised in that discussion that if F is of= =20 type float or even double-float, it has a mantissa of limited size, and=20 then the distribution of D would significantly deviate from the uniform=20 distribution if High-Low happens to be large. In the current case,=20 however, High-Low < 50, so the solution using the uniformly distributed=20 float should work properly. If D would significantly deviate from the=20 uniform distribution, then so would F. ------ I love the taste of Cryptanalysis in the morning! ------ --Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universit=E4t Weimar, Germany-- --8323329-983179213-1402896310=:4637--