6 lines
204 B
Text
6 lines
204 B
Text
montyHall(n) ==
|
|
wd:=[1+random(3) for j in 1..n]
|
|
fc:=[1+random(3) for j in 1..n]
|
|
st:=reduce(_+,[1 for j in 1..n | wd.j=fc.j])
|
|
p:=(st/n)::DoubleFloat
|
|
FORMAT(nil,"stay: ~A, switch: ~A",p,1-p)$Lisp
|