Jump to content

Monty Hall problem: Difference between revisions

m
→‎{{header|R}}: nonsense: apply functions are not faster than a for loop, they have basically the same problem: not vectorized, i.e. one function call per element.
m (→‎{{header|Picat}}: Added {{out}})
m (→‎{{header|R}}: nonsense: apply functions are not faster than a for loop, they have basically the same problem: not vectorized, i.e. one function call per element.)
Line 3,708:
=={{header|R}}==
 
<lang rsplus>#set.seed(19771025) Since R is# aset vectorthe basedseed languageto thatset penalizesthe forsame loops,results weas willthis avoidcode
# for-loops, instead using "apply" statement variants (like "map" in other
# functional languages).
 
set.seed(19771025) # set the seed to set the same results as this code
N <- 10000 # trials
true_answers <- sample(1:3, N, replace=TRUE)
1,336

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.