[CoLoCo] dice rolls in C

Richard Guenther richskyline at gmail.com
Wed Feb 6 00:16:10 GMT 2008


Jim, you remind me of my students in the programming club.  On our forum
once one of the kids said something like "Do NOT use Josh's program to do
one billion bottles of beer on the wall!  Locked my computer right up!--had
to reboot."

I think RNG is a great topic for science fair.  In fact, I recently wrote
some Python programs to answer questions that our math department found too
difficult to answer using theoretical probability.  The question was, "If
you flip a coin until you get three heads in a row, how long will the
average trial be?"  Some teachers thought the question didn't make sense
because of independent events, but I argued that it must have some specific
answer.  I'm sure if we looked at it longer we could have proved it using
theoretical probability, but I wrote a Python program to run the experiment
a few millions times and solve the question using (quasi)experimental
probability.  The answer was always 13.999 or 14.00001 or so, so I guess
it's 14.  The cool thing was that some trials went to 250+ tosses.

On Feb 5, 2008 2:11 PM, Jim Hutchinson <jim at ubuntu-rocks.org> wrote:

>
>
> Cool, that did it. Thanks. I'm currently simulating 1 trillion rolls.
> Wonder how long it will take.....
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-us-co/attachments/20080205/62b9c69a/attachment.htm 


More information about the Ubuntu-us-co mailing list