belun.app Blog RU

How a Random Number Generator Works (and When to Use One)

What makes a random number generator fair, why crypto randomness beats Math.random(), and practical uses from raffles to sampling.

Numbered lottery balls in a draw machine, illustrating a random number generator

I once watched a team pick a giveaway winner by scrolling a spreadsheet and stopping “whenever it felt right.” It did not feel right to the people who didn’t win. Picking a number out of your own head is never actually random — we drift toward 7, avoid the edges, and repeat favorites without noticing. A computer doesn’t have those habits, which is the whole point of using one.

The Random Number Generator draws numbers for you between any two values, in the browser, with no sign-up and nothing sent to a server.

What “random” really means here

There are two kinds of randomness software can give you, and they are not equal.

The common one is Math.random(). It’s fast and fine for shuffling a quiz or jittering an animation, but it’s pseudo-random: a formula produces a stream that looks random while being fully determined by a hidden starting value. If someone learns that seed, they can predict every number that follows.

This tool uses the other kind — the Web Crypto API (crypto.getRandomValues). The browser pulls entropy from hardware-level noise the operating system collects, so the output isn’t reproducible from a seed. It’s the same source password managers use. For a raffle, that’s the difference between “probably fine” and “actually defensible if someone asks.”

With repeats or without

The single setting that trips people up is the Unique toggle, so here’s the plain version:

  • Leave it off and numbers can repeat — like rolling a die over and over. Roll five times and you might get two 4s.
  • Turn it on and every result is different — like drawing raffle tickets from a bowl and not dropping them back in.

Pick “without repeats” for winners, lottery picks, and assigning people to slots. Pick “with repeats” for dice, simulations, or anything that models independent events.

One rule the tool enforces: you can’t draw more unique numbers than the range holds. Ask for 10 different numbers between 1 and 5 and it’ll tell you so instead of looping forever — there are only five values to give.

Things people actually use it for

  • Giveaways and raffles — list entrants 1 to N, draw the winners without repeats, screenshot the result.
  • Classroom cold-calling — number the roster and let it pick who answers, so it isn’t always the same three hands.
  • Sampling — auditing 40 invoices out of 2,000? Generate 40 unique row numbers and pull those.
  • Games — dice, card positions, board moves when the physical set is missing.
  • Test data — quick numeric IDs or values when you’re throwing together a prototype.

A note on fairness

Random and fair aren’t the same word. A generator that’s mathematically uniform can still feel unfair if nobody can check it. So when stakes matter, do the draw where people can watch: share the screen, agree on the range and count first, then generate once. The honesty is in the procedure, not the algorithm — though it helps that the algorithm here isn’t cutting corners either.

Set your range, choose how many numbers you need, and let the Random Number Generator do the picking — fairly, and without the spreadsheet theatrics.

Try the tool

Random Number Generator →