Skip to main content
CaseSwitch

Random Number Generator

Use the CaseSwitch Random Number Generator to draw integers or decimals in a min–max range with `crypto.getRandomValues()`-backed sampling. Good for raffles, fixtures, and demos — not a certified gaming device.

Written by the CaseSwitch editorial team. We maintain these tools in the browser so drafts, keys, and images stay on your device.

Last reviewed: 23 July 2026

Uses secure browser randomness when available. Nothing is sent to a server.

Examples

Sample output shape — integers 1–100

Input

min: 1 · max: 100 · quantity: 5 · decimals: 0

Output

(illustrative samples — each run differs)
17
42
3
88
61

Sample output shape — inclusive bounds

Input

min: 5 · max: 5 · quantity: 3

Output

5
5
5

Sample output shape — two decimal places

Input

min: 0 · max: 1 · decimals: 2 · quantity: 3

Output

(illustrative)
0.17
0.84
0.03

Error shape — inverted range

Input

min: 10 · max: 1

Output

Minimum value cannot be greater than maximum value.

Sample use — raffle ticket numbers

Input

min: 1000 · max: 1999 · quantity: 1

Output

(illustrative single draw)
1453

How to use

  1. Enter minimum and maximum (integers for whole draws; any numbers for decimal mode).
  2. Set quantity and decimal places (0 for inclusive integers).
  3. Generate and copy the newline-separated list.

What this tool is for

Pick one or many numbers uniformly between a minimum and maximum you set. Decimals of 0 (default) produce inclusive integers via rejection sampling into the range. Decimals above 0 map a secure float into [min, max] and format with a fixed number of places. Quantity defaults to five (up to 100).

How it works

Integer mode uses `secureRandomInt` with `crypto.getRandomValues` and rejection sampling so every integer in the inclusive range is equally likely. Decimal mode uses `secureRandomFloat` (also from `getRandomValues`) scaled into the continuous interval, then `toFixed(decimals)`. Invalid or inverted bounds return an error instead of a silent swap.

When to use it

Classroom raffles, load-test IDs, sprint poker numbers, Monte Carlo toy demos, and filling numeric columns in mock CSV. Document the range if the result matters later.

When not to use it

Cryptographic keys (use the Strong Password Generator or a real KDF). Gambling products that need certification. Expecting unique draws when quantity is large relative to a tiny range — duplicates are allowed unless you sample without replacement elsewhere.

How it compares to related tools

The Random Choice Generator picks from your pasted list. The Random Date Generator returns calendar days. The UUID Generator is for 128-bit identifiers, not small integers.

Common mistakes

Assuming decimals of 0 still yields floats, treating a screenshot of one draw as cryptographic proof, and using 0–1 with decimals 0 when you wanted a continuous unit interval (set decimals ≥ 1).

Integer fairness and duplicates

Inclusive integer sampling is uniform across the range. Drawing many values from a small range will repeat; that is expected with replacement. For unique winners from a named list, use the Random Choice Generator with duplicates off.

Decimals versus integers

Decimals of 0 uses integer CSPRNG mapping. Decimals > 0 scales a secure float and formats with `toFixed`, so you get fixed-place strings, not arbitrary-precision rationals. Extremely wide ranges that exceed safe integer sampling limits will error rather than bias silently.

Frequently asked questions

Is this fair for a giveaway?+

It is unbiased within the limits of the browser CSPRNG. For high-stakes prizes, use a published method and a third-party draw tool your audience trusts.

Can I get unique numbers?+

This tool samples with replacement. For unique picks from a list, use Random Choice with Allow duplicate picks off, or shuffle offline.

Are bounds inclusive?+

For integers (decimals 0), yes — both min and max can appear. Decimal mode spans the continuous interval between min and max.

Does it use Math.random?+

No. Sampling uses `crypto.getRandomValues` via the shared secure helpers.

What is the quantity limit?+

Up to 100 values per generate. Raise quantity only as high as you need to keep the list readable.

Can I generate negative numbers?+

Yes if min and max are negative or straddle zero. Keep min ≤ max.

Are these values cryptographically secure?+

Random generators use crypto.getRandomValues() in your browser for secure randomness where supported.

Related tools