Chapter 2: Math Operations 53
7302ENG.DOC CH2 Math Operations, English Julie Hewlett Revised: 07/29/98 11:58 AM Printed: 05/19/99 8:58
AM Page 53 of 32
coin( coin( 1
"
"
6 6
Returns a random list of 0s and 1s that represents heads and
tails for one or more coin tosses. tosses is a positive whole
number.
coin(tosses)
Simulate tossing a coin 7 times.
:1""6
7Eb
dice( dice( 1
"
"
7 7
Returns a random list of numbers (between 1 and 6) that
represents dice rolls. dice( takes one optional argument,
#ofdice, a positive whole number>1. If #ofdice is specified,
each list element is the total sum of one rolls results.
dice(rolls[,#ofDice])
Simulate 5 dice rolls for one die.
:1""7
5Eb
Simulate 5 rolls of 3 dice.
:-£
3Eb
³
³
³
Your result may
vary.
4 heads and 3 tails
(or 3 heads and 4 tails).
Your result may vary.
The three dice totaled 11 on
the first roll, 10 on the
second roll, etc. Your result
ma
y
var
y
.