FormatterHQ

Random Decimal Number Generator

Generate random decimal (floating-point) numbers between two values with a fixed number of decimal places, for prices, measurements and test data.

Loading tool…
Ready.

How to use the Random Decimal Generator

  1. Enter the minimum and maximum, for example 0 and 1 or 9.99 and 499.99.
  2. Choose the number of decimal places (0 to 15).
  3. Set how many numbers you need and whether they must be unique or sorted.
  4. Generate and copy the values.

Random decimal generator with the precision you choose

This random decimal generator produces numbers with a fractional part, such as 0.7342 or 128.05. You set the range and the number of decimal places, and each value is drawn uniformly from the range using 53 bits of cryptographically secure randomness, the full precision of a JavaScript double.

Values are rounded to the requested decimal places, so with 2 decimals you get prices like 17.40, trailing zeros included, which keeps columns neatly aligned.

Examples

SettingsSample output
0 to 1, 4 decimals0.3187, 0.9021, 0.0456
9.99 to 499.99, 2 decimals42.18, 311.90, 87.04
-90 to 90, 6 decimals (latitude)47.608013, -33.868820
35.5 to 39.5, 1 decimal (body temperature °C)36.8, 38.1

What to use random decimals for

  • Sample prices and amounts for e-commerce demos, invoices and charts.
  • Sensor-style readings such as temperature, humidity or voltage for dashboards and IoT prototypes.
  • Coordinates within a bounding box for map testing.
  • Probabilities and weights between 0 and 1 for simulations and machine-learning experiments.
  • Precision tests that check how your code rounds and formats numbers.

A note on floating-point precision

Computers store most decimals in binary, which cannot represent values like 0.1 exactly. That is why 0.1 + 0.2 evaluates to 0.30000000000000004 in JavaScript and many other languages. The generator formats each number as text with exactly the decimals you asked for, but once you import the values into code and add them up, tiny rounding errors can appear. For money, store amounts as integer cents or use a decimal type in your database.

Very high precision settings (more than about 15 significant digits in total) exceed what a double can hold, so the last digits are not meaningful.

Negative ranges and mixed signs

Bounds can be negative, for example -1 to 1 for normalized values or -180 to 180 for longitudes. The sign is handled correctly, and rounding applies to the absolute number of decimal places you choose.

Distribution

Numbers are spread uniformly: every sub-interval of the same width is equally likely. Real-world measurements are often bell-shaped instead; to approximate a normal distribution you can average several uniform values in a spreadsheet.

For whole numbers use the random number generator, and for exact fractions such as 3/8 try the random fraction generator. Everything runs in your browser; no values are sent to a server.

Frequently asked questions

Can the maximum value itself be generated?
Values are drawn from the half-open interval from the minimum up to, but not including, the maximum. After rounding, a value may display as the maximum when it lies very close to it.
How many decimal places can I choose?
Anywhere from 0 to 15. Beyond about 15 significant digits, standard double-precision numbers cannot store more detail, so higher settings would not add real precision.
Why do my imported decimals add up to slightly wrong totals?
Binary floating point cannot represent most decimal fractions exactly, so sums accumulate tiny errors. Round results when displaying them, or use integer cents or a decimal type for money.
Can I generate unique decimals?
Yes, enable the unique option. With few decimal places and a narrow range there may not be enough distinct values, in which case the tool asks you to lower the count or turn off the unique option.

Last updated October 3, 2026

Related tools