Skip to main content

Random Number Generator

A random number generator draws inclusive integers from a minimum through a maximum using crypto.getRandomValues with rejection sampling so the result is not biased by modulo. Optional unique draws and ascending sort. Browser CSPRNG, not a hardware entropy lab.

Inclusive lower bound. Whole numbers only.

Inclusive upper bound. Example: 1 to 6 can roll a 6.

Without replacement. Count cannot exceed the size of the range.

How to use the random number generator

  1. Set the inclusive minimum and maximum (whole numbers).
  2. Set how many numbers to draw (1 to 1000).
  3. Leave Unique on for sampling without replacement, or turn it off to allow repeats.
  4. Optionally sort ascending, then Generate. Nothing is uploaded.

Random Number Generator

Unbiased integers from Web Crypto

Sourcecrypto.getRandomValues
Bias controlRejection sampling, not value % n
RangeInclusive min through max
UniqueDraw without replacement when checked
Count1 to 1000
NotMath.random, lottery authority, or lab TRNG

What the random number generator does

The random number generator produces uniform integers from minimum through maximum inclusive. Every integer in that closed interval is equally likely. Draws use the browser Web Crypto API with rejection sampling, not Math.random. Count may be up to 1000. Unique draws cannot exceed the size of the range (max - min + 1).

Web Crypto versus Math.random

Browsers expose Math.random for casual animation timing and crypto.getRandomValues for a CSPRNG backed by the OS entropy pool. This page uses the latter. Mapping raw bits onto an arbitrary range with n % range can slightly favor smaller remainders; rejection sampling discards biased draws so each integer stays equally likely.

With and without replacement

Unique is on by default: a sample without replacement, like drawing raffle tickets. Turn unique off to allow repeats (like rolling the same die many times). For names instead of numbers, use the list picker or spin the wheel.

Not a lottery or crypto key

This is a fair integer generator for lists, games, and classroom draws. It is not a national lottery draw and not a way to mint encryption keys. Passwords have their own page: password generator.

Limits

Integers only (no floating point on this form). Minimum and maximum must be safe whole numbers. Unique count cannot exceed the range size. CZNull does not receive the draws.

Random number generator questions

Is this Math.random?
No. It uses Web Crypto with rejection sampling for unbiased integers.
Is the maximum inclusive?
Yes. Minimum 1 and maximum 6 can roll a 6.
What happens if Unique count exceeds the range?
You get an error instead of silent repeats.
Can I generate floating-point numbers?
Not on this page. Integers only.
Does this page upload what I type?
No. The work runs in this browser tab.
Is this suitable for encryption keys?
No. Use a dedicated key or password tool. This page is for fair integer draws in lists and games.