« first day (1547 days earlier)      last day (2264 days later) » 

1:40 AM
@MatthewLundberg It seems so. Is it wrong?
 
 
7 hours later…
8:12 AM
6 messages moved to Trash
Hiya \o
 
 
3 hours later…
11:10 AM
Hi @Axeman, help me please with my problem :)
Please have a look my chat above regarding the problem
 
11:34 AM
@Anastasiya-Romanova秀 Sorry I don't read Python so I can't translate.
 
@Axeman How about the problem wording, could you translate it for me so that I can simulate it correctly?
By being correct means to get result 1-1/e
As n to infinity
 
single_trial <- function(n) {
  any(sample(n, n, replace = TRUE) == 1)
}

many_trials <- function(n, m) {
  mean(replicate(m, single_trial(n)))
}

many_trials(5, 1000)
You need to sample many times to get a reasonable answer.
 
11:50 AM
OK, let me try after having dinner
Thanks...
You're really my hero :D
 
plot(purrr::map_dbl(1:100, many_trials, 5000), ylim = c(0, 1))
abline(h = 1 - 1 / exp(1))
 
 
1 hour later…
12:58 PM
@Anastasiya-Romanova秀 The answer is entirely correct. It does answer why you converge to a value that is so far from unity.
 

« first day (1547 days earlier)      last day (2264 days later) »