Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
include xpllib; \for Print
|
||||
|
||||
func real SleepingBeauty(Reps);
|
||||
int Reps, Wakings, Heads, Coin, I;
|
||||
[Wakings:= 0; Heads:= 0;
|
||||
for I:= 0 to Reps-1 do
|
||||
[Coin:= Ran(2); \heads = 0, tails = 1 say
|
||||
Wakings:= Wakings + 1;
|
||||
if Coin = 0 then Heads:= Heads + 1
|
||||
else Wakings:= Wakings + 1;
|
||||
];
|
||||
Print("Wakings over %d repetitions = %d\n", Reps, Wakings);
|
||||
return float(Heads) / float(Wakings) * 100.;
|
||||
];
|
||||
|
||||
real PC;
|
||||
[PC:= SleepingBeauty(1_000_000);
|
||||
Print("Percentage probability of heads on waking = %1.6f\%\n", PC);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue