Maths & numbers

Random integer and decimal generator

Draw uniform random integers or fixed-decimal numbers from an inclusive interval, with a copyable results list.

Your settings

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Generate result.

Report an issue

Try it, understand it

Explore the result

Draw uniform random integers or fixed-decimal numbers from an inclusive interval, with a copyable results list.

Worked example comparison
ExampleOutputWhat to notice
Worked exampleNumbers generated5The interval 1 through 100 with zero decimal places contains 100 possible integers. The sample form returns five draws.
Decimal draws from 0 to 1Numbers generated5At two places the inclusive interval has 101 possible values.

Check your understanding

What happens if no grid point lies in the interval?

The calculator asks for wider bounds or more decimal places. For example, 1.1 to 1.9 contains no whole number.

What does the “Decimal draws from 0 to 1” setting illustrate?

At two places the inclusive interval has 101 possible values.

Behind the tool

How this tool works

The decimal setting defines a grid of possible values. For two places, each grid point differs by 0.01. The browser uses a cryptographic random source and discards out-of-range samples to keep the available values equally likely.

THE OUTPUT RULEScale the interval by 10^places, round the lower bound up and upper bound down, then sample a uniform integer.

A worked example

The interval 1 through 100 with zero decimal places contains 100 possible integers. The sample form returns five draws.

Good to know

Independent draws with replacement. Repeated values are possible. The generator requires the browser’s cryptographic random API.

How the inputs affect the result

To assign numbered slips to participants, check that the endpoints correspond to real slip numbers. Use a separate selection without replacement when the same participant must not appear twice.

At two places the inclusive interval has 101 possible values.

Where the calculation applies

Independent draws with replacement. Repeated values are possible. The generator requires the browser’s cryptographic random API.

For a related calculation, see the Polyhedral dice roller.

A few questions, answered

What happens if no grid point lies in the interval?

The calculator asks for wider bounds or more decimal places. For example, 1.1 to 1.9 contains no whole number.

What does the “Decimal draws from 0 to 1” setting illustrate?

At two places the inclusive interval has 101 possible values.

Find your calculator

Start typing to explore the library.