Share this

Probability - Random Numbers

Given that a lottery has 10 million potential combinations, what are the odds that someone will win with 90% confidence given that 10 million tickets are sold. Clearly it would not be 100% since some tickets would be duplicates. I am less interested in the answer than in the methodology used to solve it.

Scott from New York, New York

Lets try to rephrase the question. Assuming the lottery has 10 million combinations, and all players choose their numbers randomly (allowing for duplicates), how many tickets would the lottery need to sell so that the probability of at least one person winning is 90%? Lets let p be the probability of winning and n be the number of tickets sold. The probability of 1 person losing is 1-p. The probability of all n people losing is (1-p)n. The probability of at least one winner is 1 - (1-p)n. So we need to set this equal to .9 and solve for n.

.9 = 1 - (1-p)n
.1 = (1-p)n
ln(.1) = ln((1-p)n)
ln(.1) = n*ln(1-p)
n = ln(.1)/ln(1-p)
n = ln(.1)/ln(.9999999)
n = 23,025,850.

So, the lottery would need to sell 23,025,850 tickets for the probability of at least one winner to be 90%. In case you were wondering, if the lottery sold exactly ten million tickets the probability of at least one winner would be 63.2%, which is very closely approximated as 1-(1/e).

This is my second question to you, this time the subject is state lotteries. I'm sure you've heard of a group of "investors" which used to wait for a jackpot to reach a certain level, at which point they would purchase tickets with every combination of numbers possible. This would assure them a share of the prize. Assuming the cost of a ticket is $1, how high must the jackpot get for this to be a profitable venture?


A factor in the answer is the total number of tickets sold to other players. In the event more than one player hits the jackpot it will have to be shared. Let's call the number of possible combinations n, the total number of other tickets sold t, the rate of return on the small prizes r (in the case of the Big Game r=0.179612), and j be the jackpot size. For this to be a break-even venture j*n/(n+t) + r*n - n=0. This works out to j=(1-r)*(n+t).

I disagree with a statement you made regarding random number generation in computers. While it is true that a sequence will appear and repeat after time, it is not true that this is unavoidable. The trick is setting a correct seed. If you are using a UNIX-based architecture, one method is to set the seed to the seconds passed since 1/1/70, which is a constantly updated variable inside the system. Since you are using Visual C++ and J++, they should reset themselves to some random seed each time they are run, but it would be wise to set the seed yourself during the program. I think you would be wise to set the random seed each time a new deck is ’dealt’ to the current time on the machine or something similar. In this way, yes, you will be using the same loop of numbers, but at least you will be picking moderately ’random’ points along the way, so as to not make it a total loop.

Joe B. from Pittsburgh, Pennsylvania

When using Visual C++, the seed is evidently always the same. If I give the program the same input, then the output will always be the same after a random simulation. It is my understanding that this is what Microsoft intended, so that experiments could be replicated exactly. Visual J++ is evidently different based on my games, otherwise the same hands would occur in the same order every time.

Postscript: Since this writing I have a slower but much better way of calling random numbers. Click here for more information.

I believe I remember reading that if there is a group of twenty people in a room the odds of two of them sharing the same birthday is less than 50/50. Is this true?

Ginny from Seattle, Washington

The probability of 20 different people all having different birthdays (ignoring leap day) is (364/365)*(363/365)*(362/365)*...*(346/365) = 58.8562%. So the probability of at least one birthday match is 41.1438%. Also, 23 is the fewest number of people needed for the probability of a match to be greater than 50%.

I play and they have 94 numbers of which you have to hit 6 in any order. I would like to know the odds of hitting 6 out of 94 since this site originated nobody has ever won the 3 million.

Sandee from Norwood, USA

The probability of getting 6 out of 94 correct is 1 in combin(94,6) = 1 in 814,216,767.

Great site, Mike! Often times I hear the word, "binomial distribution" being used in gambling. Can you explain to me what it means? Thanks in advance.

Dennis from Toronto, Ontario

Thanks for the compliment. Any introductory probability and statistics book should give good treatment to the binomial distribution. Briefly, the binomial distribution is the probability that any given number of events will happen given a specific probability for each event and a specific number of trials. Specifically if the probability of each success is p, the number of success is s, and the number of trials is n then the probability of s successes is ps * (1-p)n-s * combin(n,s). The combin function is explained in my glossary. For example, suppose you want to know the probability that in 100 spins of a roulette wheel the number of reds will be exactly 60. According to the binomial distribution, the probability is (18/38)60 * (20/38)40 * combin(100,60) = 0.003291.

Excel also has a function for the binomial distribution. It is =BINOMDIST(x,n,p,0), where:

x=number of positive trials. n=total number of trials. p=probability of success in any given trial.

Use a 0 in the fourth position of the function for the exactly probability of x wins. For the probability of x or less wins, use a 1.

In the roulette example above, the function would be =BINOMDIST(60,100,18/38,0)

Can you please explain what the term "Law of mathematical averages" mean? Thank you, and keep up the good work.

Dennis from Canada

I think what you are referring to is actually called the "Law of Large Numbers." This states that for a random sample of n random variables with mean x, that the sample mean xn converges to x as the size of the sample approaches infinity. We can think of the outcome of a bet as a random variable. This law tells us that as the number of bets becomes very large the average result will get closer to the house edge.

I'd really like to know how to read odds like 12 to 1, or 3 to 2. Which one shows the best chances of winning? 12 to 1 or 3 to 2?

Louis from Montreal, Canada

I don't like using probabilities in that form but they are generally used in this kind of syntax, "The odds against drawing a royal flush are 649,739 to 1." That means there are 649,739 ways you can't draw a royal flush and 1 way you can. In your examples 12 to 1 is a probability of 1/13, or 7.69%, and 3 to 2 is 2/5, or 40.00%, so the 3 to 2 is the better chance of winning.

If multiple choice questions have possible answers of a,b,c,d,and e: what is the probability that among 100 guesses, there will be at least 25 correct responses?

Daniel from Portales, USA

The probability of getting exactly x right in your example is combin(100,x)*(1/5)x*(4/5)(100-x). To get the exact answer you have to calculate this for all values of x from 0 to 24, add them up, and take the difference from 1. The answer is 13.14%.

My Grandmother was born on October 28, 1912, she recently passed away on October 28, 2001 (her 89th birthday). My cousin asked me what the statistical odds were of this occurring. I know there is about a 1 in 365 chance of dying on any day throughout the year. But what are the odds of that day being a person’s birthday?

Loren from Petersburg, Alaska

You should have asked me this while I was still an actuary at the Social Security Administration. I could have easily have done a nationwide query on death records. I would say the answer is close to 1 in 365. It probably is a little less because infant mortality rates are disproportionately high after birth. For births in the year 2000 the probability of death within the first year is 0.71% of male infants and 0.59% for female infants. In other words those infant deaths are unlikely to occur on the birthday because once the first birthday arrives the child is outside of the danger period. Also, and I don’t know this to be a fact, but on the shoe ’Six Feet Under’ they said that the business for funeral directors picks up in January, evidently because people try to hold on for just one more Christmas holiday and then let go. This same logic might apply to reaching a birthday. Consider George Burns, he died 48 days after his 100th birthday.

I played the same number 1000 spins in a row on a 0,00 wheel and hit 6 times. What are the chances of hitting 6 or fewer times in this scenario?

Bill K.

The probability of your number hitting exactly x times is combin(1000,x)*(1/38)x*(37/38)1000-x. The following table shows the probability of all number of hits from 0 to 6 and the total.

Wins in 1000 Roulette Bets

Number Probability
0 0.00000000000262
1 0.00000000007078
2 0.00000000095556
3 0.00000000859146
4 0.00000005787627
5 0.00000031159330
6 0.00000139655555
Total 0.00000177564555

So the answer is 0.00000177564555, or 1 in 563175. I hope this didn’t happen at an Internet casino.

You may wonder why I didn’t use the normal approximation as I did with the coin flipping problem above. That is because it doesn’t work well with very high and very low probabilities.

Just for simplicity, let’s say there are 322 cups on a table and one has a ball under it. What are the chances that I will pick the ball if i pick a cup 75 times (and the cups don’t go away after I pick it up, it’s always a random pick with 322 cups). At first I just thought to say 75/322, but I realized that was incorrect, as 322 picks does not result in a 100% chance of getting the ball because I could pick a million times and not get the ball.

John from Miami

Your answer would be correct if you removed cups after an incorrect pick. Since you leave the cups on the table each pick as a 1/322 chance of being right, or 321/322 of being wrong. The probability of 75 picks being wrong is (321/322)75 = 79.193%. So the probability of getting at least one correct in 75 picks is 100% - 79.193% = 20.807%.

Would you tell me the probability of a 19% chance coming in exactly 18 out of 34 trials?


That would be combin(34,18)*.19^18*(1-.19)^(34-18) = 0.000007880052468.

Which do I have better odds of winning:
A. one shot at 1 in 4
B. five shots at 1 in 20

Mike from Lansing

The probability of A is obviously 25%. The probability of getting zero shots out of five is 0.955=77.378%. So the probability of getting at least one out of five is 100%-77.378%=22.622%. So A has the higher probability.

On a 38 number Roulette wheel....after hitting three reds, a green, and then another red....what are the odds, that the next consecutive three spins would come up red 23?

Paul from Raleigh

It doesn’t make any difference what the past spins were. The probability of red 23 three times in a row is (1/38)3 = 1 in 1 in 54,872.

I recently acquired a carnival wheel that belonged to my great uncle, it’s about a hundred years old and I’m trying to develop a game around it. It’s numbered 1-60 in random order and it alternates black and red with a green star every fifteenth mark, could you help me outline how much the payoffs should be for each spin?

Mike from Olympia

So there are 30 black, 30 red, and 4 green numbers. That would make the probability of black 30/64, red 30/64 and green 4/64. If the probability of an event is p then the fair odds are (1-p)/p to 1. So fair odds for any red would be (34/64)/(30/64) = 34 to 30 = 17 to 15. Same for black. The fair odds on green are (60/64)/(4/64) = 60 to 4 = 15 to 1. For a specific number the fair odds are (63/64)/(1/64) to 63 to 1.

I suggest paying 1 to 1 on red and black, 14 to 1 on green, and 60 to 1 on any individual number. One formula for the house edge is (t-a)/(t+1), where t is the true odds, and a is the actual odds. In this case the house edge on the red or black bet is (63-60)/(63+1) = 3/64 = 4.69%. On the green bet the house edge is (15-14)/(15+1) = 1/16 = 6.25%. On individual numbers the house edge is (63-60)/(63+1) = 3/64 = 4.69%.

A test consists of 10 multiple choice questions, each with 5 possible answers, 1 of which is correct. To pass the test a student must get 60% or better on the test. If a student randomly guesses, what is the probability that the student will pass the test?

Kirk from Canton

The probability of exactly 6 correct is combin(10,6)×0.26×0.84 = 0.00550502.

The probability of exactly 7 correct is combin(10,7)×0.27×0.83 = 0.00078643.

The probability of exactly 8 correct is combin(10,8)×0.28×0.82 = 0.00007373.

The probability of exactly 9 correct is combin(10,9)×0.29×0.81 = 0.00000410.

The probability of exactly 10 correct is 0.210 = 0.00000010.

Adding the probabilities for 6 to 10 correct, the probability of at least six correct is 0.00636938.

If I make 1,000,000 spins on the event that has 1 in 1,000,000 chance of winning, what are my chances of winning at least once?

Ares75 from Petrovce

If the probability of winning is 1/n, and you play n times, as n approaches infinity, the probability of winning at least once approaches 1-(1/e), where e = 2.7182818..., or about 63.21%. The exact answer can be expressed as 1-(999,999/1,000,000)1,000,000 = 0.63212074. My estimate is 1-(1/e) = 0.63212056, which agrees to six decimal places.

In a race, if the competitors’ race numbers are allocated randomly, and have no effect on race performance, what are the chances that at least one person will finish the race in a position that matches his race number? For example, the winner has number one on his chest or the person who finishes three hundred and fifth happens to sport number 305.

Stewart from Glasgow

Assuming that no numbers are skipped, the probability depends very little on the number of participants, as long as that number is fairly large. The greater the number of participants, the more the probability of at least one match will approach 1-(1/e) = 63.21%.

Hi, In Australia we have Lotto, where the major cash prize is paid if your six numbers are drawn from a possible 45 numbers (1-45) A lot of people purchase a "Slik Pik," where you get 12 games, each of six, allegedly random, random picks. My friends and I are always amazed that in the 12 games, the same number may appear up to 6 or 7 times out of the 12 games. Surely this is not random!!! My question is what is the expected number of times any number will repeat 6 or 7 times, assuming the selection is random?

Kevin from Perth, Western Australia

The expected number of times any number will appear exactly n times in 12 games is combin (12,n)×(6/45)n×(39/45)n-12. The following table shows the expected number of occurrences from 0 to 12.

Expected number of repeat numbers

Repeats Expected
0 8.0804888027
1 14.9178254818
2 12.6227754077
3 6.4732181578
4 2.2407293623
5 0.5515641507
6 0.0989986937
7 0.0130547728
8 0.0012552666
9 0.0000858302
10 0.0000039614
11 0.0000001108
12 0.0000000014
Total 45

So, to answer your question, you will see the same number exactly six times about 0.099 times per set of cards, or about once every 10.1 times. The same number appearing exactly seven times will happen 0.0131 times per set of cards, or once every 76.6 times.

I read that the chances of drawing the same three-digit number two nights in a row are 1 in a million. But since the actual number drawn itself has no significance, the odds are really one in a thousand, right?

Jon from Philadelphia

You're right. The probability of the same sequence of numbers chosen two nights in a row is 1 in 1000. The question that the writer was answering is what is the probability that 1-9-6 is drawn twice is a row, which is indeed one in a million. However, as you note, the pertinent question is what are the odds that any sequence repeats. The answer to that question is (1/10)3 = 1 in 1000.

What is the mean distance between two random points in a unit square?


For a question so easy to ask, the solution is rather involved. The way I did it, you will need to know this integral.

Here is the answer and my solution (PDF).