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: border2.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: Lotto simulation Date: Mon, 16 Jun 2014 14:13:19 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <77cc4476-8c57-481b-afb9-8f53f8b16e37@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 16 Jun 2014 14:13:19 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="76a49b86bc3e16725b7cfca3d85cb4c8"; logging-data="23526"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QLdgQHQ22UkvHaOJNWuW2" User-Agent: slrn/1.0.1 (FreeBSD) Cancel-Lock: sha1:6n5OwwR4GwVlQs5Bg99VtoZSN70= X-Original-Bytes: 3128 Xref: number.nntp.dca.giganews.com comp.lang.ada:186970 Date: 2014-06-16T14:13:19+00:00 List-Id: On 2014-06-16, J-P. Rosen wrote: > Le 16/06/2014 13:15, Stefan.Lucks@uni-weimar.de a écrit : >> Well, do you think the Annotated Reference Manual >> 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