comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Lotto simulation
Date: Sun, 15 Jun 2014 21:54:33 +0100
Date: 2014-06-15T21:54:33+01:00	[thread overview]
Message-ID: <ly4mzl6ghi.fsf@pushface.org> (raw)
In-Reply-To: 77cc4476-8c57-481b-afb9-8f53f8b16e37@googlegroups.com

montgrimpulo <aghte@hotlinemail.com> writes:

> A workaround would be to test in each round, if that number has
> already been selected.  However, the probability would not be the same
> as with a reduced set as the selection would be always from the full
> set.

This seems perfectly reasonable.

If you think of numbered balls like the UK lottery, and after each pick
replace the picked ball by one without a number.  By the time you get to
the last 2 numbered balls, each of them has a 50% chance of being the
one that's eventually picked, no matter how many times you discard
unnumbered balls. Depending on the RNG, of course.

Another possibility: create an array of {ball-number, random-float},
sort by the random-float component, choose the first N entries.

  parent reply	other threads:[~2014-06-15 20:54 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
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 [this message]
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