Probability of generating a sequence of numbers between 1 and n

1.1k Views Asked by At

Let's say we want to generate a random number between 1 and n, n-times,then the probability that every integer between 1 and n appears once in the generated sequence of random numbers is $\frac{n!}{n^n}$. So if we were to generate a number between 1 and 10, 10-times, the probability that every number between 1 and 10 appears once in the generated sequence of numbers is $\frac{10!}{10^{10} }$, which is about 1 in 3000. So we should expect that if we do this process of generating 10 numbers 3000 times we should get a sequence of numbers where all numbers between 1 and 10 apeear once only one time. But when I tried this on my calculator(it has a button for generating integers) I got that pattern of all integers between 1 and 10 appearing without repeating after my 15th trial! So does that mean my calculator dose not actually generate random numbes?

Or in another words: what is the probability that after generating 10 numbers (between 1and 10) randomly 15 times you get a sequence where all integers between 1 and 10 appear once without repeating?

2

There are 2 best solutions below

2
On BEST ANSWER

The probability that after generating 10 numbers (between 1 and 10) randomly 15 times you get a sequence where all integers between 1 and 10 appear at least once is

$$ 1-\left(1-\frac{10!}{10^{10}}\right)^{15}\approx0.00543. $$

0
On

Paraphrasing:

Probability of seeing 10 distinct numbers is about 1 in 3000. So we should expect that if we do this process 3000 times we should get the outcome only one time.

This is not true. By your logic, since a coin flip has a $1/2$ chance of being heads, if you flip a coin twice, you should always get exactly one heads and one tails, which is not true.

In your situation, it is entirely possible (but extremely unlikely) that you get a sequence of 10 distinct numbers every single time out of the 3000 trials.

The interpretation of "the probability is about 1 in 3000" should be this: if you did this process $n$ times and computed the proportion of trials where you did see 10 distinct numbers, then this proportion will approach $1/3000$ as $n \to \infty$. (This is the law of large numbers.)

For a fixed large $n$, it will usually be close to $1/3000$, but it is still possible that it is not; things like the central limit theorem can quantify this more concretely.