Random Number Generator

Generate truly random numbers within any range. Pick a single integer for quick use, or switch to the comprehensive version for bulk generation, decimal precision control, and more.

Random Number Generator

Enter a lower and upper limit, then click Generate to produce a random integer within that range.

Comprehensive Version

Generate multiple random numbers at once. Switch between integers and decimals, and control the number of decimal places.

How do I get a random number between 1 and 50 without getting the same one twice? This tool cannot promise that, because each draw is independent, and knowing why will save you from a bad raffle. It has a quick one-number box and a bulk section that produces up to 10,000 integers or decimals within limits you choose, with the decimal places set by you.

From a Raw 0-to-1 Value to Your Number

Take the default range of 1 to 100. Suppose the browser's random source hands back 0.7342. Multiply by 100 to get 73.42, drop the fraction to get 73, and add the lower limit of 1. The box shows 74.

The first step counts the possible outcomes: max − min + 1 = 100 − 1 + 1 = 100. The +1 matters, because without it the upper limit could never appear. The second step is floor(r × count) + min. The raw value r can be 0 but never exactly 1, so r = 0 gives 1 and r = 0.9999 gives 100, which means both limits are reachable and equally likely.

Decimal mode uses a different formula: r × (max − min) + min, then rounding to the number of places you chose. For limits 2.5 and 7.5 with 2 places and r = 0.3141: 0.3141 × 5 = 1.5705, plus 2.5 is 4.0705, which rounds to 4.07.

That rounding has a side effect at the edges. A value can only round to the lower or upper limit from one side, so those two get half a bin each. In a 2-million-draw simulation of limits 0 and 10 at zero decimals, 0 and 10 each turned up about 5% of the time, while 1 through 9 each turned up about 10%. Integer mode does not have this problem.

Repeats are the other thing to expect. Because every draw is independent, ten integers between 1 and 100 contain at least one repeat with probability 1 − (100 × 99 × ... × 91) / 100^10, which is about 37.2%. Five numbers from 1 to 50 repeat about 18.6% of the time.

How to Use This Calculator

  1. For one integer, type the Lower Limit and Upper Limit in the top section (the defaults are 1 and 100) and press Generate.
  2. For a batch, use the second card below it, the bulk version: enter both limits and How Many to Generate (1 to 10,000).
  3. Choose Integer or Decimal. Decimal Precision is only active for decimals and accepts 0 to 20 places.
  4. Press Generate and read the list in the text box, one number per line; select it to copy.
  5. Press Clear to return that section to 1, 100, 10 results and 2 places.

Frequently Asked Questions

Can I generate a list with no duplicates?

There is no unique option. For something like a raffle, generate more numbers than you need, remove repeats by hand, and keep the first ones you have left. For a very small range, writing the values on slips and drawing is simpler.

Are these numbers truly random, and can I use them for security?

They come from the browser's pseudo-random generator, which is excellent for games, sampling and choosing who goes first. It is not a cryptographic source, so do not use it for keys, passwords or anything where someone might try to predict the output.

Why do I get an error that limits must be whole integers?

In integer mode, and in the single-number box at the top, both limits must be whole numbers, so 1.5 is rejected. Switch the bulk section to Decimal if you want fractional limits. A lower limit larger than the upper limit is also refused.

Does a negative range work?

Yes. Limits of -5 and 5 give 5 − (−5) + 1 = 11 possible values, and each is equally likely. Just make sure the lower box holds the more negative number.

Why are the limits themselves rare in decimal mode with 0 places?

Rounding gives the lower and upper limit only half the range that every other value gets, so each shows up about half as often. If both ends must count equally, use Integer mode or pick limits slightly wider than you need.