Convertful
ImagePDFVideoUtilityBlog

Image Tools

  • Compress Image
  • Resize Image
  • Remove Background
  • HEIC to JPG
  • All Image Tools →

PDF Tools

  • Compress PDF
  • Merge PDFs
  • Split PDF
  • PDF to Images
  • All PDF Tools →

Video & Audio

  • Video to GIF
  • Compress Video
  • Trim Video
  • Extract Audio
  • All Video Tools →

Utility

  • QR Code Generator
  • JSON Formatter
  • Color Converter
  • All Utility Tools →
All processing happens in your browser. Your files never leave your device.
AboutBlogTermsPrivacyContact
© 2026 Convertful. All rights reserved.
HomeUtilityRandom Number Generator

Random Number Generator

Cryptographically secure random numbers in any range. Free, private, runs in your browser.

100% private — your files never leave your browser. All processing happens locally on your device.

Sort:

You might also need

Dice RollerRoll dice with RPG notation — 2d6, d20+5, 4d6k3, advantage rolls
UUID GeneratorGenerate random UUIDs (v4) instantly
Password GeneratorGenerate secure random passwords instantly

When Math.random Isn't Enough

JavaScript's built-in Math.random() is a linear congruential generator — it produces the same sequence every time if you know its internal state. It's adequate for casual use but unsuitable for draws, lotteries, secure token generation, or anything where predictability would matter. This tool uses the Web Crypto API's getRandomValues(), which seeds from the operating system's entropy source (hardware noise, thermal variations, user input timing — depending on the platform). The result is cryptographically secure randomness in your browser, with zero server roundtrips.

Unbiased Range Sampling

A naïve random-in-range uses `Math.floor(Math.random() * span) + min`. For most uses this is fine, but when span doesn't divide evenly into the 2^32 random space, certain values become slightly more likely than others (modulo bias). The tool uses rejection sampling: draw a full 32-bit value, discard it if it falls in the 'biased zone', otherwise map to the range. Slightly slower in the worst case, perfectly uniform in the limit.

Unique vs. With Replacement

By default, values are drawn with replacement — duplicates are possible. Enable 'Unique values only' when you need N distinct values from a range, for example drawing lottery numbers, picking raffle winners from a list, or assigning unique IDs. The generator keeps drawing until it has N non-duplicate values. If you ask for more unique values than the range can provide (say 10 unique values in 1–5), the tool tells you it's impossible rather than looping forever.

Sort, Copy, Repeat

Sort the output ascending or descending — handy for drawing sorted sequences. A one-click copy button puts the values in your clipboard as a newline-separated list, ready to paste into a spreadsheet or script. Generate up to 10,000 values in a single click; beyond that, a dedicated script is better than a browser tab.

Stays In Your Browser

No values are transmitted, logged, or shared. If you're using this for a giveaway, lottery, or any draw where fairness matters, the fact that no server saw the numbers is a feature — nobody can claim the result was tampered with between client and server, because there was no server.

FAQ

How is this different from Math.random()?

Math.random() is a seeded pseudo-random generator — predictable if you know its state, and unsuitable for anything security-sensitive (draws, lotteries, unique IDs, passwords). This tool uses crypto.getRandomValues() with rejection sampling to avoid modulo bias. Cryptographically secure, uniformly distributed, suitable for anything short of key generation.

What's the 'unique' option for?

When you need N distinct values from a range — drawing lottery numbers, assigning unique IDs to a finite set, random sampling without replacement. The tool rejects duplicates as it generates until you have the count you asked for. Won't let you ask for more unique values than the range contains.

Is there a limit on how many values I can generate?

10,000 per click. More than that starts to get slow in the browser, and real use cases rarely need more. For huge batches, a proper dedicated tool or a shell one-liner is better.