Write the Random-Number Specification First
A request for random numbers is incomplete until it identifies the value type, lower and upper boundary rules, number of values, replacement rule, required order, decimal resolution, and random source. A programmer asking for 0 through 9, a teacher drawing five unique student numbers, and a simulation requesting four-place decimals are not asking the same question.
Record those choices before looking at an outcome. Changing a range after seeing a result, rerunning until a preferred value appears, or switching between repeats and uniqueness without disclosure changes the procedure and can introduce selection bias even when each individual batch was generated correctly.
- Integer or fixed-precision decimal
- Inclusive lower and upper limits
- Batch size
- Repeats allowed or sampling without replacement
- Generated or sorted display order
- Web Crypto or a disclosed repeatable seed
Turn the Requested Range Into Countable Slots
Uniform selection needs a finite set of outcomes. An inclusive integer range a through b contains b - a + 1 slots. Decimal mode creates a finite grid by choosing p places: multiply both exact boundaries by 10^p, select an integer slot from the scaled range, then restore the decimal point.
This fixed-precision model is inspectable. From 1.00 through 1.03 at two places, the four outcomes are 1.00, 1.01, 1.02, and 1.03. Asking for an arbitrary real number between two boundaries would describe infinitely many outcomes and would not match a finite digital generator.
Avoid Biased Range Mapping
Random bytes naturally represent a power-of-two number of bit patterns, while a requested range often contains a different number of slots. Taking every raw value modulo the range size can give some slots one more source pattern than others. The difference may be small, but it is systematic rather than random.
Rejection sampling draws enough bits for the range, discards candidates outside its size, and retries. Every accepted integer index then has the same number of source patterns. The calculator applies this method before adding the lower boundary.
Choose Replacement Rules Deliberately
With replacement, every draw uses the full range, so repeats are possible and each draw has the same marginal distribution. Without replacement, each selected slot is removed for the rest of the batch. Repeats become impossible, but later draws are dependent on earlier ones because the remaining set has changed.
A unique batch cannot be larger than its range. If a range has six slots, six unique picks return every slot in a randomized order; seven unique picks are impossible. For very large ranges, partial shuffling can sample the requested positions without storing every candidate.
Separate Entropy From Deterministic Reproduction
Web Crypto exposes random values produced from a user agent's cryptographic random source. Its security still depends on the browser and operating environment, but it is the appropriate browser primitive for unseeded random generation. Ordinary Math.random is not specified for cryptographic use.
A seed serves a different purpose: reproduction. A deterministic generator transforms the same initial state into the same sequence, allowing a test failure, lesson, or example to be repeated. Reproducibility is useful evidence for debugging, but predictability makes a small seeded generator unsuitable for secrets and adversarial settings.
Read Batch Statistics Without Overinterpreting Them
Minimum, maximum, median, sum, average, unique count, and duplicate count describe the returned sample. They can reveal an out-of-range value, a broken uniqueness rule, or an unexpected sort, but they do not certify the random source. A fair short sample can contain clusters, long gaps, repeated values, or an average far from the range midpoint.
Statistical testing requires a predeclared design, enough observations, appropriate tests, and careful interpretation of false positives and multiple comparisons. Passing statistical tests does not by itself make a source unpredictable; RFC 4086 specifically distinguishes statistical appearance from security-grade unpredictability.
Audit a Generated Batch Step by Step
Confirm that every value belongs to the reported discrete range and has the requested precision. Recount the rows, compare the unique and duplicate totals, and verify the ledger's original positions when sorted output is selected. For a seeded run, repeat the exact settings and confirm the sequence; for an unseeded run, do not expect a rerun to differ in every position.
When the outcome has consequences, audit the procedure as well as the arithmetic. Identify who chose the settings, when they were locked, how participants or items were enumerated, whether exclusions were declared, how the result was recorded, and what independent oversight the context requires.
Know When a Browser Generator Is Not Enough
A convenient browser tool can support casual games, lessons, sample data, and local testing. It is not automatically suitable for security keys, authentication tokens, clinical randomization, research allocation, public lotteries, gambling, admissions, legal rights, or material prizes. Those contexts may require approved algorithms, controlled entropy, tamper evidence, access restrictions, preregistered procedures, logs, observers, and jurisdiction-specific compliance.
Use the governing standard or a qualified independently audited service when trust depends on more than obtaining a number in range. A clear limitation is more valuable than labeling an ordinary web page certified or fair without evidence.
Frequently asked questions
How do I generate a random number between two numbers?
Choose Integer or Decimal, enter the inclusive lower and upper limits, select the batch size and options, and press Generate numbers. Every returned value will be inside the mode-adjusted range.
Are the lower and upper limits included?
Yes. Integer mode includes the first and last whole numbers inside the entered interval. Decimal mode includes both exact boundaries when they match the selected decimal precision.
Can this random number generator create decimals?
Yes. Decimal mode supports 0 through 50 decimal places. It selects among equally spaced fixed-precision slots rather than pretending to choose from infinitely many real numbers.
How can I generate random numbers without repeats?
Choose Unique values only. The calculator samples without replacement and rejects a request larger than the number of available integer or decimal slots.
Is this a cryptographically secure random number generator?
With a blank seed, range values are derived from browser Web Crypto random bytes with rejection sampling. The page is not an audited security or regulated-drawing system, and seeded mode is explicitly not cryptographically secure.
What does the repeatable seed do?
A seed initializes a deterministic local sequence. The same seed and settings reproduce the batch, which helps testing and demonstrations. It must not be used for passwords, keys, tokens, gambling, or regulated selections.
Does sorting change the random draw?
No. Ascending or descending order changes only how the existing batch is displayed. The complete ledger preserves each value's original draw position.
References
These sources support the method or guidance used for Random Number Generator. Verify time-sensitive rules at the source.
Try the calculator
Open Random Number Generator, enter your scenario, and compare its supporting rows with this guide's method and checks.
