Skip to content
andcode Tools

Random Number & Code Generator

🔒 Runs in your browser

Press “Generate”.
Presets

How this random number generator works

Set a minimum, a maximum and how many numbers you need, then press Generate. Each value is drawn with your browser's crypto.getRandomValues — the same source that backs secure keys — using rejection sampling so every number in the range is equally likely. Naïve generators reuse a raw draw with a single modulo, which quietly makes the lowest few numbers more common; discarding the short out-of-band tail removes that bias entirely.

Unique draws, sorting and presets

Tick No repeats for a draw where no value appears twice — you then cannot request more numbers than the range contains. Sort ascending orders the result, which is handy for lottery tickets and sampling. The presets are shortcuts: Dice gives one number from 1–6, Coin flip returns Heads or Tails, and Loto 6/49 draws six unique numbers from 1 to 49, sorted.

Random codes and strings

Switch to Codes mode to generate random codes instead of numbers — coupon and voucher codes, PINs, short IDs or throwaway strings. Choose the length and tick which character types to mix in: uppercase, lowercase, digits and symbols. The PIN, Voucher and Short code presets are one-click starting points, and No look-alikes drops confusable characters like O/0 and I/l/1 so a printed or dictated code is never misread. Each character is picked with the same bias-free crypto draw used for the numbers.

Random vs. cryptographically secure

This tool is not seedable: there is no way to reproduce a past sequence, which is exactly what you want for passwords, tokens, raffles and fair draws. If you instead need a repeatable pseudo-random sequence for a simulation or a unit test, use a seeded PRNG in your own code — a client-side web tool cannot offer reproducibility and unpredictability at the same time.

Frequently asked questions

Are the numbers truly random?

They are cryptographically strong: every draw comes from crypto.getRandomValues with rejection sampling, so each value in the range is equally likely — no modulo bias. This is not a seedable pseudo-random sequence.

Can I generate a random code or string?

Yes — switch to Codes mode and set a length plus which characters to include: uppercase, lowercase, digits and symbols. Presets cover a 4-digit PIN, an 8-character voucher and a short 6-character code, and you can exclude look-alike characters such as O/0 and I/l/1.

How do I get numbers with no repeats?

Tick “no repeats”. You then cannot ask for more numbers than the range holds — for example at most 49 distinct values between 1 and 49.

Can I generate lottery numbers?

Yes. The Loto 6/49 preset draws 6 unique numbers from 1 to 49 and sorts them ascending. Change the fields for any other draw format.

Is anything sent to a server?

No. Generation happens entirely in your browser and nothing is transmitted or stored.

Related tools

Clear local data?

This permanently erases everything this site has saved in this browser:

  • Saved audio projects (Audio Mixer autosave)
  • Project boards, cards and attachments (Kanban)
  • Your favorite tools
  • Preferences, such as your language choice

This can't be undone, and it only affects this browser on this device.