Skip to the tool

Random number generator

MDV Tools

Whole numbers from any range, as many as you need, drawn fairly.

Runs on this device Works offline
set a range and press draw
How this works

Without a seed, every number comes from crypto.getRandomValues. To land in a range of size n the page takes a 32-bit draw — or a 53-bit one for ranges past four billion — and discards it if it falls in the short leftover stretch beyond the last whole multiple of n, so every number in the range has exactly the same chance. Ranges run to about nine quadrillion either side of zero, the largest whole numbers JavaScript holds exactly.

No repeats draws without putting anything back: the page runs a partial Fisher–Yates shuffle over the range without ever writing the whole range out, so ten numbers from a billion cost the same as ten from a hundred. Asking for more numbers than the range holds is refused, since there are not that many to give. Sort orders the result after the draw; it never changes which numbers came out.

A seed makes the draw repeatable: the same seed with the same settings gives the same numbers on any device, which is how a raffle or a sample can be checked afterwards by someone who was not there. The seed is hashed into a small generator, sfc32, which is statistically sound but not secret — anyone who knows the seed knows the numbers, so publish the seed after the draw, not before, and never use a seeded draw for a password or a key. Without a seed, nothing can reproduce a draw, not even this page.

Draws are capped at 10,000 numbers at a time. Nothing is sent and nothing is stored; the Dark button keeps its own setting in this browser's local storage.