Loading Techie Utils…

Random Number Generator

Draw uniformly random integers or decimals in a range, with or without repeats. Free, and runs entirely in your browser — nothing is uploaded.

About Random Number Generator

Drawing a random number fairly is harder than it looks. The common Math.floor(Math.random() * n) is slightly biased toward low values whenever n does not divide the generator's range evenly. Math.random is also not a cryptographic generator, so its output can be predicted.

Here every draw comes from crypto.getRandomValues, with rejection sampling: a draw that falls in the uneven remainder is thrown away and drawn again, so every value in the range is exactly as likely as every other. Draws without repeats use a partial Fisher–Yates shuffle, the same way cards are dealt from a deck.

Set a range, how many numbers, and optionally decimal places. The results can be sorted and written one per line, comma-separated or space-separated, ready to paste into a spreadsheet or code.

Where it helps

  • Cryptographically random, with rejection sampling so there is no modulo bias.
  • Draws without repeats correctly, and says so when the range is too small for the count asked.
  • Handles negative ranges and up to ten decimal places exactly.
  • Shows the lowest, highest and mean of a batch, as a quick check on the spread.

Limits

  • Draws up to 10,000 numbers at a time. For more, use a script with the same method.
  • It is not an audited process. A draw with legal or financial consequences needs a documented, witnessed one.

Frequently asked questions

Is Math.random() good enough?

For shuffling a playlist, yes. For anything security-related or anything that has to be demonstrably fair, no: Math.random is not cryptographically secure, and scaling it with multiply-and-floor introduces a small bias. This tool avoids both problems.

What is modulo bias?

If a generator produces values 0 to 9 and you want 0 to 2, taking the remainder mod 3 maps four values to 0 and only three each to 1 and 2. So 0 comes up more often. Rejection sampling discards the extra values and draws again, which removes the bias.

How are decimals drawn?

As whole numbers at the chosen precision, then scaled. 5 to 50 with two decimal places is a draw from 500 to 5000 divided by 100, so every value with two decimals in the range is equally likely.

Related tools

  • Random String — Random identifiers from a chosen alphabet
  • UUID Generator — UUID v1 to v7 — generate any version, or read what one encodes
  • Password Generator — Strong random passwords with an entropy estimate
  • Fake Data — Synthetic people and companies as JSON, CSV or SQL
  • ULID / CUID Generator — Sortable, collision-resistant identifiers — and the timestamp inside one
  • Nano ID Generator — Short, URL-safe random identifiers — and what the length actually buys

More Generators tools

  • UUID Generator — UUID v1 to v7 — generate any version, or read what one encodes
  • ULID / CUID Generator — Sortable, collision-resistant identifiers — and the timestamp inside one
  • Nano ID Generator — Short, URL-safe random identifiers — and what the length actually buys
  • KSUID Generator — Sortable 27-character identifiers with a second of time and 128 bits of randomness
  • TypeID Generator — Type-prefixed identifiers over UUID v7, readable and still a UUID underneath
  • ObjectID Generator — MongoDB's twelve bytes — a timestamp, a process value and a counter
  • Barcode Generator — Draw QR, Data Matrix, Code 128, EAN and more as SVG
  • QR Code Generator — Create scannable QR codes as SVG
  • UPI QR Code Generator — Make a UPI payment QR code that any UPI app can scan to pay you
  • Diagram Studio — Draw architecture, sequence, ER, C4, network and nine other diagrams by dragging shapes and connecting them
  • Random String — Random identifiers from a chosen alphabet
  • Lorem Ipsum — Placeholder paragraphs, sentences or words
  • Fake Data — Synthetic people and companies as JSON, CSV or SQL