Originally posted by scooterscot

https://www.contractoruk.com/forums/...ml#post2002494


nums <- c(rep(0, 1000))
for (j in 1:1000){
count <- 0
people <- c(rep(FALSE, 1000))
while (TRUE) {
count <- count + 1
k <- sample(1:1000,4,replace=F)
for (i in 1:4){
people[k[i]] <- TRUE
}
if (all(people)) {break}
}
nums[j] <- count
}
print(mean(nums))

Comment