Random number generator 1-49: pick 6
This random number generator for 1 to 49 picks 6 distinct numbers in your browser. There are 13,983,816 possible sets and every one of them is equally likely.
Notice: For entertainment and informational purposes only. Generated numbers are random and do not improve the odds of winning. CompoundPage is not affiliated with or endorsed by Powerball, Mega Millions or any lottery operator. Lottery participation is restricted by age and by law. If you or someone you know has a gambling problem, call 1-800-GAMBLER.
6 random numbers
- Where this came from Your browser's cryptographically secure generator, not Math.random(). V8 implements Math.random() with xorshift128+, whose internal state can be recovered from a short run of its own output. That is fine for shuffling a playlist and unusable for anything anybody would call a secret.
- crypto.getRandomValues()
- Debiased by 2^32 is not a multiple of 49, so 39 values would get one extra chance each under plain modulo. Those words are drawn again instead of used, which costs 0.000001% of draws and makes every outcome exactly equally likely.
- rejection sampling, discarding 39 of 2^32 words
- Skew avoided How much more likely the favored outcomes would have been under
getRandomValues() % range. For small ranges it is far below anything observable; the reason to do it properly is that the same line of code is wrong by nearly 2x for ranges near 2^31, and nobody rewrites it when the range changes. - 0.00000114%
- Range size
- 49 values
- Entropy 6 independent draws from 49 values. For comparison, a six-character lowercase password carries about 28 bits and a four-word passphrase from a 7,776-word list about 51.
- 33.7 bits
- Odds of this exact set Drawn without replacement, so order does not matter and there are C(49, 6) possible sets. This is the arithmetic behind every lottery: 6 from 49 is 13,983,816.
- 1 in 13,983,816
- The numbers in the HTML were drawn once when the site was built, so without JavaScript every visitor sees the same ones. With JavaScript on, which is the normal case, the draw happens in your own browser, from your own generator, and nothing is sent anywhere.
How the Random Number Generator works
This generator draws 6 integers from 1 to 49 with no repeats, from 49 possible values per draw.
The classic lottery draw, and the one that makes the combination arithmetic concrete: there are C(49, 6) = 13,983,816 possible sets, so one ticket has about a one in fourteen million chance. Drawn without replacement, which is why this generator uses a partial Fisher-Yates shuffle rather than drawing six times and retrying on collisions. The retry version works here but degenerates as the draw approaches the range size. Worth noting what the odds are not sensitive to: every set is exactly as likely as every other, so 1-2-3-4-5-6 has the same chance as any scattered-looking set. The only thing picking an unusual-looking set changes is how many people you would share a jackpot with.
The draw happens in your browser, from crypto.getRandomValues(), which reads your operating system's cryptographically secure generator. It is not Math.random(): that is xorshift128+ in V8, fast and statistically fine for a game, and predictable to anyone who sees a short run of its output. Nothing about your draw is sent anywhere, because there is nowhere for it to be sent: the page is static and the generator is local.
A 32-bit word has 4,294,967,296 possible values and 49 does not divide it evenly; the remainder is 39. Under the usual word % 49, those 39 values would each get one extra chance, making 39 outcomes very slightly more likely than the rest. This generator rejects those words and draws again, which costs about one draw in 110,127,367 and makes the distribution exactly uniform instead of nearly so. For a range this size the skew being removed is around 0.0000011%. That is undetectable in practice, but the same code is wrong by nearly 2x for ranges near 2^31, which is the real reason to write it correctly.
Drawn without replacement, so the 6 results are distinct and order does not matter: there are C(49, 6) = 13,983,816 possible sets. That is the number any odds claim about this draw rests on.
One thing about how the result reaches you: the site is statically hosted, so the numbers in the HTML were drawn once when the site was built. If you have JavaScript turned off, that is what you are looking at, and every other such visitor sees the same thing. With JavaScript on, the generator redraws immediately from your own browser. A generator that quietly serves one cached "random" value to everybody is broken, which is why the build-time draw is labeled.
Random Number Generator FAQ
How do I draw 6 numbers from 1 to 49?
The generator above does it on load and on every press. It draws from your browser's crypto.getRandomValues() and discards the 39 words that would skew the result before mapping it onto the 49 values.
Is every number in this range equally likely?
Yes, exactly. The 39 words that would have made some outcomes marginally likelier are rejected and redrawn, so each of the 49 outcomes ends up with exactly 87,652,393 words behind it. Within a draw the numbers are distinct, so later picks come from a shrinking pool, but every possible SET is equally likely, which is the property that matters.
Is there anything particular about this range?
The classic lottery draw, and the one that makes the combination arithmetic concrete: there are C(49, 6) = 13,983,816 possible sets, so one ticket has about a one in fourteen million chance. Drawn without replacement, which is why this generator uses a partial Fisher-Yates shuffle rather than drawing six times and retrying on collisions. The retry version works here but degenerates as the draw approaches the range size. Worth noting what the odds are not sensitive to: every set is exactly as likely as every other, so 1-2-3-4-5-6 has the same chance as any scattered-looking set. The only thing picking an unusual-looking set changes is how many people you would share a jackpot with.
Can I rely on it not being predictable?
For anything short of a regulated draw, yes. The source is the same operating-system facility that generates cryptographic keys. The limit worth knowing is that it is a CSPRNG seeded from hardware entropy rather than a hardware true-random device sampling a physical process, and no software running in a browser tab can be the latter.
More from the Random Number Generator
- Random number generator 1 to 10
- Random number generator 1 to 100
- Random number between 1 and 6
- Random number from 1 to 2
- Random number generator 1 to 1000
- Bingo caller
- Lottery number generator