RosettaCodeData/Task/Sleeping-Beauty-problem/J/sleeping-beauty-problem-2.j
2023-07-01 13:44:08 -04:00

13 lines
431 B
Text

sample=: sb"0 i.1e6 NB. simulate a million mondays
#sample NB. number of experiments
1000000
#;sample NB. number of questions
1500433
+/;sample NB. number of heads
749617
+/0={.@>sample NB. how many times was sleeping beauty drugged?
500433
(+/%#);sample NB. odds of heads at time of question
0.4996
sample+&#;sample NB. total number of awakenings
2500433