Simulation Using Random Numbers

Goals: This laboratory applies random number generators to a range of experiments involving the multiple rolls of dice and multiple tosses of a coin.

Previous laboratory work simulated the rolling of a die, by defining a procedure roll-a-die using Chez Scheme's random procedure to obtain random integers 1, 2, 3, 4, 5, and 6. That work also simulated the rollng of a die several times, showing the results of each of n tosses. The resulting procedure was called roll.

We can simulate the rolling a pair of dice by calling roll-a-die twice -- perhaps making a list out of the two results:


   (define pair-of-dice
       (lambda ()
           (list (roll-a-die) (roll-a-die))
       )
   )

This document is available on the World Wide Web as

http://www.math.grin.edu/~walker/courses/151.sp04/readings/simple-simulations.xhtml

This document is available on the World Wide Web as


created February 5, 1997
last revised January 16, 2004
Validated as XHTML 1.0 by the World Wide Web Consortium Cascading Style Sheet validated by the World Wide Web Consortium
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.