A random number generator returns an 8-digit base 10 number. (If needed, the number is left-padded with 0s)

How many numbers can be generated without exceeding a 30% probability that two of the generated numbers are equal?

Printable View

- May 31st 2012, 06:04 PMblmalikovRandon number generator problem
A random number generator returns an 8-digit base 10 number. (If needed, the number is left-padded with 0s)

How many numbers can be generated without exceeding a 30% probability that two of the generated numbers are equal? - May 31st 2012, 06:45 PMblmalikovRe: Randon number generator problem
I discovered that this problem is, in essence, the birthday problem. To anyone curious, the answer is 8446. This problem was for a computer science class. All things considered, if you want an 8-digit primary key for a database and intend to fill up the table with well more than 8446 rows, you had better take into account that there's a 30% probability that two are equal if you generate the keys randomly. And with each additional row, the probability that two are equal grows steeply and then quickly approaches one.