Question: Using RAND to simulate coin toss

Trying to simulate tossing 10 coins. What  am i doing rong? Thanks

 

> 

``

> 

restart

> 

a := Vector[row](1 .. 10)

Vector[row](%id = 18446745395177063238)

(1)
> 

randomize()

> 

for k to 10 do r := rand(1 .. 2); if r < .5 then a[k] := "H" else a[k] := "T"; print(a[k]) end if end do

proc () (proc () option builtin = RandNumberInterface; end proc)(6, 2, 1)+1 end proc

 

Error, cannot determine if this expression is true or false: r < .5

 
> 

a

Vector[row](%id = 18446745395177063238)

(2)
> 

``


 

Download CoinToss.mw

 

 

Please Wait...