Format Code Now
/
Random generatorsRandom Decimal Generator Next: Random Hex Generator ›

Random Decimal Number Generator

RG-04

Type a lowest and highest value, choose the decimal places and press Generate. Every value is a random number in that range written with exactly that many places.

Runs in your browser. Nothing is uploaded.

Range: lowest and highest on one line (empty means 0 1)

Decimal numbers

How to use it

  1. Type the range on one line, such as 0 100 or -5.5 5.5. Leave the box empty for 0 to 1.
  2. Choose Decimal places, from 0 to 15.
  3. Choose how many numbers you want, up to 1000.
  4. Press Generate, then copy or download the list.

How the values are chosen

The range is scaled by the decimal places, so 0 to 1 with 2 places becomes the whole numbers 0 to 100. One whole number is drawn from that range with unbiased rejection sampling and written back as a decimal. Every value that can be written with those places is equally likely, and both ends of the range can appear.

Exact digits, no rounding

The arithmetic uses big integers instead of floating point, so long values do not lose digits and 0.1 plus 0.2 style errors cannot creep in. Trailing zeros are kept, so you get 0.50 and not 0.5. If your range has more decimal places than you selected, such as 0 0.125 with 2 places, the page stops with an error instead of rounding your limits.

Typical uses

Sample prices, sensor readings, test coordinates, or filler numbers for a spreadsheet. The numbers are random draws, not measurements, and they are independent of each other, so a list will contain repeats when the range is small. For whole numbers use the integer generator, which also supports no repeats.

Error messages and what to do

MessageWhat it meansFix
The first number is larger than the second. Put the lowest first.The range was typed highest first.Swap the two numbers.
The range has more decimal places than the 2 you chose. Raise the decimal places or shorten the range.A limit such as 0.125 has more places than the Decimal places setting.Pick more places or shorten the limit.

Questions people ask

How do I generate a random decimal number?

Type a minimum and maximum, choose how many decimal places you want, and press Generate. Each line is a random decimal inside your range. With no input the range is 0 to 1.

How do I get random decimals between 0 and 1?

Leave the input empty or type 0 1, choose the number of places such as 4, and press Generate. You will get values like 0.3817, with both 0 and 1 possible.

Can I generate negative decimals?

Yes. Type a range such as -10 10. Negative values are written with a leading minus sign and the same number of decimal places as the rest.

How many decimal places can I use?

From 0 to 15 are offered in the menu. With 0 places the output is whole numbers. The math uses exact integers, so even 15 places do not suffer floating point rounding.

Are the numbers evenly spread?

Yes. Each value that fits the chosen places has the same chance. Within a list you can still see clusters and repeats, which is normal for random numbers.

Is a random decimal safe to use as a secret?

The source is your browser's secure random generator, but values with few places have few possibilities. Do not use a short decimal as a password or key. Use the password or random bytes tools for that.

About this tool

Picks a whole number uniformly from the range once it is scaled by the decimal places you choose, then writes it back as a decimal, so every value that can be written with that many places is equally likely, and both ends of the range are included. The arithmetic uses exact big integers, so long values are not rounded. If the range has more decimal places than you selected, the page stops with an error instead of rounding it. Numbers are not rounded after the fact, and trailing zeros are kept (0.50, not 0.5). Everything is made in your browser with crypto.getRandomValues, nothing is stored or sent, and each click gives new values.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.