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.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!rt.uk.eu.org!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!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: Sun, 15 Jun 2014 22:10:31 +0200 Organization: Privat Message-ID: References: <77cc4476-8c57-481b-afb9-8f53f8b16e37@googlegroups.com> NNTP-Posting-Host: pd953d8e3.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: online.de 1402863032 28676 217.83.216.227 (15 Jun 2014 20:10:32 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Sun, 15 Jun 2014 20:10:32 +0000 (UTC) User-Agent: KNode/4.12.4 Xref: number.nntp.dca.giganews.com comp.lang.ada:186935 Date: 2014-06-15T22:10:31+02:00 List-Id: montgrimpulo wrote: > this is a placeholder of the task which I am trying to solve in Ada. > As you may know in German Lotto there are 49 numbers 1..49 > from which you have to select 6 numbers to place a bet. > > Second Round: > Here does my problem start. Now I have a set of numbers where > one number - which was randomly selected in the first round - > is missing. How do I use the random function to select another > random number out of the rest ? > > Any ideas to answer that question ? Let's look at how it works in reality: A random ball is selected out of a set of 49 balls, mixed randomly before the pick, resulting in a new set of 48 balls, etc. So you'd need to start with a sorted array of integers 1 to 49, mix it randomly and then pick a random index out of 1 to 49. The number at that index is then removed from the array. 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. Dito for round 3 to 6. HTH... 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