Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Monty-Hall-problem/PARI-GP/monty-hall-problem.parigp
Normal file
13
Task/Monty-Hall-problem/PARI-GP/monty-hall-problem.parigp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
test(trials)={
|
||||
my(stay=0,change=0);
|
||||
for(i=1,trials,
|
||||
my(prize=random(3),initial=random(3),opened);
|
||||
while((opened=random(3))==prize | opened==initial,);
|
||||
if(prize == initial, stay++, change++)
|
||||
);
|
||||
print("Wins when staying: "stay);
|
||||
print("Wins when changing: "change);
|
||||
[stay, change]
|
||||
};
|
||||
|
||||
test(1e4)
|
||||
Loading…
Add table
Add a link
Reference in a new issue