Random Decimal Number Generator

Produces random decimal numbers built to a specific shape — how many digits appear before the decimal point and how many after — rather than sampling a plain min/max range, useful for generating realistic-looking test values like prices or measurements. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

This tool generates random decimal numbers built to a specific digit shape you choose — a fixed count of digits before the decimal point and a fixed count after.

Unlike a plain min/max random number, it's about controlling how many digits appear on each side of the decimal point, which is useful for generating realistic-looking sample data.

What Is Random Decimal Number Generator?

A digit-shape decimal generator: set how many digits should appear before the decimal point and how many after, and get a random value matching that shape.

The leading integer digit is always non-zero, so a 3-digit integer part never displays as something like '012.5' — it always looks like a genuine 3-digit number.

How Random Decimal Number Generator Works

The tool builds the integer part one digit at a time: the first digit is drawn from 1-9, and every subsequent digit from 0-9, concatenated into a string.

The decimal part is built the same way from 0-9 digits, and the two parts are joined with a period unless the decimal place count is zero, in which case only the whole number is shown.

When To Use Random Decimal Number Generator

Use it when you need decimal-looking sample data with a specific, consistent digit shape — like always 2 digits before the decimal and 2 after, mimicking currency amounts.

For sampling a value within an actual min/max magnitude range instead, use Random Number Generator's decimal mode.

Features

Advantages

  • Guarantees a consistent digit shape across a whole batch, useful for tabular sample data.
  • Avoids misleading leading zeros in the integer part.
  • Batch generation produces many values in one pass.

Limitations

  • Does not control the overall magnitude range — a 2-digit integer part can be anywhere from 10 to 99, not a specific min/max you set.
  • Not cryptographically secure — built on Math.random().

Examples

A 2-digit, 2-decimal value

Input

(no input; generated from settings: integer digits 2, decimal places 2)

Output

47.83

Two digits before the decimal point (first digit non-zero), two after.

A whole number with zero decimal places

Input

(no input; generated from settings: integer digits 3, decimal places 0)

Output

926

No decimal point is shown since decimal places is zero.

Best Practices & Notes

Best Practices

  • Match the integer digit count to the magnitude of realistic data you're simulating — 2 digits for typical prices, more for larger figures.
  • Set decimal places to 2 for currency-style test data.

Developer Notes

Each digit is generated independently as a separate character rather than by formatting a single random float, which avoids floating-point rounding artifacts that can occur when calling toFixed() on an arbitrary sampled value.

Random Decimal Number Generator Use Cases

  • Generating realistic-looking sample prices or measurements for test data
  • Producing decimal values with a guaranteed consistent digit shape for a spreadsheet column
  • Demonstrating decimal number structure in a teaching context

Common Mistakes

  • Expecting this tool to respect a magnitude min/max — it controls digit counts, not numeric bounds; use Random Number Generator for range-based sampling instead.
  • Setting decimal places very high (close to 15) and finding the output harder to read than intended.

Tips

  • Use integer digits 1 and decimal places 2 for simple 'X.YZ' style values.
  • Combine several batches with different digit shapes if you need varied-magnitude sample data.

References

Frequently Asked Questions