Toolbox Hub
All Tools

Random Number Generator

Generate random numbers

Generate random numbers Runs locally in your browser

Minimum and maximum, separated by a comma.

About the

The Random Number Generator returns one whole number within a range you choose, inclusive of both ends, using the JavaScript random function behind Math.random. That makes it fine for picking a winner, rolling a virtual die or choosing a sample, and not suitable for anything where predictability would cost you money, such as a raffle with a prize or a security token. For those you want a cryptographically secure generator, which the UUID tool uses instead.

Where people use the

  • Picking a winner from a numbered list of entries.
  • Rolling a virtual die for a game.
  • Choosing a random sample or a random start point.
  • Generating a throwaway value for testing.

How to use the

  1. 1

    Enter the range

    Type the minimum, then a comma, then the maximum. For example 1, 100 gives a number from 1 to 100 inclusive.

  2. 2

    Generate

    One number is produced each time you run it.

  3. 3

    Run it again for another value

    There is no memory between runs, so repeats are possible and expected.

  4. 4

    Use a secure source for anything that matters

    For prizes, tokens or anything adversarial, do not use this. Use a cryptographically secure generator instead.

Tips and best practices

  • Remember both ends are included when you set the range.
  • Never use this for a prize draw or a token; use a secure generator.
  • Expect repeats; independence means duplicates happen.

Frequently asked questions

Are both ends included?

Yes. A range of 1 to 100 can produce 1 and it can produce 100. That is the behaviour most people expect, and it is why 1 to 6 works as a die.

Is it truly random?

It is pseudo-random, produced by an algorithm from a seed. The distribution is even enough for games and sampling, but the sequence is in principle reproducible, which is why it must not be used where someone could profit from predicting it.

Can the same number come up twice in a row?

Yes. Each run is independent, so repeats are normal. If you need distinct values, generate them one at a time and discard duplicates yourself.

How large can the range be?

Very large in principle, but the result is a JavaScript number, so keep it within a safe integer range. Anything past about nine quadrillion loses precision.

Can I generate several numbers at once?

No, one per run. Run it repeatedly, or use a script if you need a large batch.

Related Tools