Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -1,17 +1,17 @@
|
|||
_iterations = 1000000
|
||||
|
||||
local fn SleepingBeauty
|
||||
NSUInteger i
|
||||
CGFloat heads = 0, sleep = 0
|
||||
NSUInteger i
|
||||
CGFloat heads = 0, sleep = 0
|
||||
|
||||
for i = 1 to _iterations
|
||||
NSInteger coinToss = int( rnd(2) )
|
||||
sleep++
|
||||
if coinToss = 1 then heads++ else sleep++
|
||||
next
|
||||
for i = 1 to _iterations
|
||||
NSInteger coinToss = int( rnd(2) )
|
||||
sleep++
|
||||
if coinToss = 1 then heads++ else sleep++
|
||||
next
|
||||
|
||||
printf @"Awakenings over %lld sleep cycles = %.f", _iterations, sleep
|
||||
printf @"Percent probability of heads on waking = %.4f%%", heads / sleep * 100
|
||||
printf @"Awakenings over %lld sleep cycles = %.f", _iterations, sleep
|
||||
printf @"Percent probability of heads on waking = %.4f%%", heads / sleep * 100
|
||||
end fn
|
||||
|
||||
randomize
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue