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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!takemy.news.telefonica.de!telefonica.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: Dirk Heinrichs Newsgroups: comp.lang.ada Subject: Re: Lotto simulation Date: Mon, 16 Jun 2014 22:22:10 +0200 Organization: Privat Message-ID: References: <77cc4476-8c57-481b-afb9-8f53f8b16e37@googlegroups.com> NNTP-Posting-Host: p57a3cd66.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: online.de 1402950131 32007 87.163.205.102 (16 Jun 2014 20:22:11 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Mon, 16 Jun 2014 20:22:11 +0000 (UTC) User-Agent: KNode/4.12.4 Xref: news.eternal-september.org comp.lang.ada:20377 Date: 2014-06-16T22:22:10+02:00 List-Id: Simon Wright wrote: > Why mix it? Thought that would be more realistic. >> You'd then create a new array of 48 integers filled with the numbers at 1 >> to picked-1 plus picked+1 to 49 of the former array, mix that array again >> and pick a random index out of 1 to 48. Again remove the number at that >> index. > > But Ada.Numerics.Discrete_Random picks a random value of the > Result_Subtype it was instantiated with. So if you want to pick a number > in 1 .. 48 you have to create a new instantiation. And the RNG is going > to start off in some state, unrelated to the present state of the RNG > for 1 .. 49. How are you going to be sure that it's not going to return > 1 every time? I was just trying to explain how the drawing works in reality w/o having any concrete Ada solution in mind. IMHO, once one ball is picked, a new situation is created, that's why I thought a new array would be a good idea. OTOH, when the values in the array are mixed, would it matter if the RNG returned 1? It's just the array index. Bye... Dirk -- Dirk Heinrichs Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913 GPG Public Key CB614542 | Jabber: dirk.heinrichs@altum.de Sichere Internetkommunikation: http://www.retroshare.org