Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,18 @@
|
|||
// sleeping beauty problem - translated from the Wren sample, via Pluto
|
||||
|
||||
sleepingBeauty = function( reps )
|
||||
wakings = 0
|
||||
heads = 0
|
||||
for _ in range( 1, reps )
|
||||
wakings += 1
|
||||
if rnd < 0.5 then // rnd returns a randome number in [0..1)
|
||||
heads += 1 // [0..0.5) = heads
|
||||
else
|
||||
wakings += 1 // [0.5..1.0) = tails
|
||||
end if
|
||||
end for
|
||||
print "Wakings over " + reps + " repetitions = " + wakings
|
||||
return ( heads / wakings ) * 100
|
||||
end function
|
||||
|
||||
print "Percentage probability of heads on waking = " + sleepingBeauty( 1000000 )
|
||||
Loading…
Add table
Add a link
Reference in a new issue