Random Number Generator - Integers and PINs Online
Draw random integers in a range or digit-only PINs with the Random Number Generator. Unique draws and crypto.getRandomValues stay in the browser.
Random results are generated in your browser with crypto.getRandomValues(). Nothing is sent to a server.
—
—
Player 1
8000
Player 2
8000
0:00
—
Show arithmetic
The Random Number Generator draws integers inside a chosen minimum and maximum, or builds digit-only PIN strings of fixed length. Set how many values to return and whether repeats are allowed. Unique range draws shuffle the integer pool; PIN mode pads shorter numbers with leading zeros when length requires it. All draws use crypto.getRandomValues with rejection sampling in the browser.
Generate random numbers in any range
Number range mode needs a minimum, a maximum, and a count. Defaults open at 1 through 100 with five values. Minimum and maximum must be integers with maximum at least as large as minimum. Count must be an integer from 1 through 1,000. Press generate to fill the result list with that many integers from the inclusive range.
Inclusive bounds matter for classroom raffles and lottery-style picks from 1 to n. A range of 1 to 6 behaves like a six-sided die face list without dice notation. The Random Number Generator truncates non-integer inputs toward whole bounds before drawing, so typed decimals do not create a fractional pool.
Generate unique numbers without duplicates
Unique set to Yes draws without replacement inside the range. The engine builds every integer from minimum through maximum, shuffles that pool with Fisher-Yates driven by crypto.getRandomValues, then returns the first count entries. If count exceeds the size of the range, generation stops with an error instead of inventing duplicates.
Unique No allows the same integer more than once across the returned list. Each value is then an independent uniform draw of the form minimum plus a fresh random offset into the span. Use unique Yes for raffle tickets and seating charts; use unique No when independent rolls of the same range are the goal.
Generate a random PIN
PIN mode asks for digit length from 1 through 12 and how many PIN strings to produce, capped at 1,000 outputs. Each PIN is a zero-padded digit string drawn uniformly from the 10^digits space. Unique Yes refuses to repeat a full PIN string in the batch; oversized unique requests make the Random Number Generator return an error.
Four-digit and six-digit lengths match common lock and bank habits. Leading zeros remain part of the string so a draw of 0042 stays four characters. Treat generated PINs as samples for demos or local testing. Do not paste them into live account recovery flows from a shared screen.
Verify the numbers are random
Uniform integers come from the site random helper: crypto.getRandomValues fills a 32-bit buffer, rejection sampling drops values that would bias a modulo, and the accepted value maps into the requested span. The Random Number Generator does not call Math.random. A privacy note states that generated values stay in the browser and are not posted to a server.
Absence of a seed field is deliberate for this tool: each press draws a fresh cryptographic sample rather than a reproducible stream. For teaching modulo bias, compare a naive remainder method in a worksheet to the rejection approach described here. The page itself only exposes the fair draw path.
Work a counting example for a small range
Take minimum 1, maximum 10, count 3, unique Yes. The pool has ten integers. After a fair shuffle, any ordered triple of distinct values is equally likely among P(10,3) = 10 × 9 × 8 = 720 ordered draws. The chance a specific number such as 7 appears in the three picks is 3/10.
With unique No, each of the three positions is an independent draw among ten faces, so 10^3 = 1,000 ordered triples exist and repeats become possible. Expected count of the value 7 across three independent draws is 3 × (1/10) = 0.3. Running the Random Number Generator several times with the same settings shows how often duplicates appear only in the with-replacement mode.
Sort and copy practical outputs
Results appear as a list of strings ready to copy into a spreadsheet column or a chat message. When a lesson needs ascending order, paste into a sheet and sort there; the generator returns draw order, which preserves shuffle sequence for unique draws. That order is the random sample, not a ranked leaderboard.
For PINs, keep the strings as text so leading zeros survive. Spreadsheet cells that coerce to numbers will drop those zeros and change the code. The Random Number Generator keeps fixed width in the on-page list for that reason.
Run a classroom raffle or die roll
Numbered tickets do not need a pasted roster. Set minimum to 1, maximum to the ticket count, unique to Yes, and count to the number of prizes. The Random Number Generator returns distinct ticket numbers in shuffle order. Treat the first listed value as first prize when rank matters, then read down the list for later prizes.
For a single six-sided die face, set minimum 1, maximum 6, count 1, and unique No. Each generate press is an independent face. For two dice that may show doubles, keep unique No and set count to 2 so both positions draw from the same 1 through 6 faces. Unique Yes with count 2 would forbid doubles and would not match ordinary dice.
Inclusive bounds mean maximum is reachable. A raffle labeled 1 through 100 must use maximum 100, not 99. After the draw, copy the result list once if the class needs a fixed record; regenerating replaces the sample.
FAQ
Are decimals supported in the range?
Decimals are not drawn. The Random Number Generator works with integers in range mode and digit strings in PIN mode. Truncation applies if a non-integer bound is entered.
What happens if unique count exceeds the range?
Generation fails with an error when unique count is larger than (maximum − minimum + 1). Lower the count or widen the range, then try again.
Does PIN mode allow leading zeros?
PIN mode pads with leading zeros to the requested digit length. A three-digit setting can return 007. Keep the value as text when copying elsewhere.
Is Math.random used anywhere?
Math.random is not used. Draws go through crypto.getRandomValues and rejection sampling in the shared random module.
How many numbers can one batch return?
One batch returns at most 1,000 values. PIN length tops out at 12 digits. Those caps keep the page readable and the draw loop bounded.
Can results be reproduced later?
This page does not offer a seed field. Each generate action draws a new cryptographic sample. Record the list if a fixed sample must be reused.
Do generated numbers leave the device?
Generated numbers stay in the browser for the session. The privacy note on the page matches that behaviour.
When should unique be turned off?
Turn unique off when each draw should ignore earlier picks, as with repeated die rolls on the same faces. Leave unique on for sampling without replacement from a finite ticket pool.
Are the minimum and maximum included?
Yes. Range mode draws inclusive integers from minimum through maximum. A setting of 1 to 10 can return both 1 and 10. The Random Number Generator counts the pool size as maximum − minimum + 1.
What is a good PIN length for demos?
Four-digit and six-digit lengths match many lock and bank demos. Keep PIN strings as text when copying so leading zeros stay. Do not use on-screen demo PINs as live account secrets.
Closing summary
The Random Number Generator covers inclusive integer ranges and fixed-length PIN strings, with optional uniqueness enforced by shuffle or by rejection of repeats. Fair draws rely on crypto.getRandomValues and rejection sampling, not Math.random, and values remain on the device. Choose unique mode from the size of the pool, then copy results as text when leading zeros matter.