Random Decimal Generator
Whole numbers not fine-grained enough? Generate decimals between any two values — prices for mock data, measurements for simulations, percentages with two places.
How the decimals are built
Each value starts as 48 fresh random bits — a fraction with 281,474,976,710,656 possible steps between 0 and 1 — which is then scaled into your range and rounded to the decimal places you asked for. At any sane number of places, the rounding grid is far finer than the values you will read, so the spread stays even across the interval. For whole numbers, prefer the main generator: its rejection sampling is exact rather than step-based.
FAQ
- Can the result equal the maximum exactly?
- Only through rounding — for example with 0 decimal places, a value just below the maximum can round up to it. If you need a strict ceiling, generate with one extra decimal place and discard exact-max results.
- What is this used for?
- Mock data, simulations, classroom probability exercises, randomising prices or measurements in tests — anywhere a value with fractions is more useful than a whole number.