Skip to content
FPSDEN

Random Number Generator (1–100)

Start with 1–100 or pick a preset up to 1–1000. This random number generator draws whole integers in the browser, takes your own bounds, or fixes a digit count. One to 100 values per batch, both endpoints included, with an optional no-repeats setting.

Choose numbers

Use range or digit count, not both.

Integer; up to 17 characters including a minus sign.

Must be at least the minimum.

Whole number 1–100.

Prevent repeated numbers within this batch.

Endpoints are included. No repeats applies only within this batch. Digits mode gives positive integers without leading zeros. Results remain exact through 16 digits.

Your numbers will appear here.

150.51001Mode = rangeMinimum = 1Maximum = 100Digits = 4

One dot per drawn number, placed on the range you asked for.

min <= each value <= max

Range, digits and no repeats

Range mode includes both endpoints, so 1–100 has 100 possible values and -5 to 5 has 11. Bounds may be negative, and each one accepts up to 17 characters, which covers every integer from -9999999999999999 to 9999999999999999. Digits mode fixes a length instead: four digits means 1000–9999 and sixteen means 1000000000000000–9999999999999999, always positive and never with a leading zero. Quantity runs from 1 to 100 per batch. No repeats applies only to the batch you just generated.

How numbers are selected

The page requests random bytes from crypto.getRandomValues, then maps them onto your range. A whole number of bytes spans a power of two, which is rarely an exact multiple of your range size, so anything above the cutoff is thrown away and redrawn. On 1–100 one byte is used: values 0 to 199 map onto the 100 outcomes, two byte values each, and 200 to 255 are discarded. That rejection step is what keeps the low numbers from being over-represented. After 128 rejected attempts the draw stops and reports a failure.

Cutoffs worked out twice

A range of 1 to 1000 needs two bytes, because its size minus one is 999. Two bytes span 65,536, and 65,536 leaves a remainder of 536 when divided by 1,000, so the cutoff is 65,000 and the byte pairs from 65,000 to 65,535 are redrawn. Each of the 1,000 outcomes then has exactly 65 accepted inputs, and about 0.8 percent of draws are thrown away. Sixteen digits works the same way: that range holds 9,000,000,000,000,000 values, seven bytes span 72,057,594,037,927,936, the cutoff is 72,000,000,000,000,000, and every outcome has eight accepted inputs.

No repeats, step by step

With no repeats on, quantity 4 from 1–6 returns four different numbers, and a quantity larger than the range fails instead of looping. The tool tracks the used values with a small map, so a range in the billions never builds a list that long. Trace 1–100 with quantity 3: the first draw takes index 40 and outputs 41, while the old tail index 99 is stored at slot 40. The second draw takes index 40 again, reads 99 and outputs 100, leaving 98 in that slot. A third draw on index 40 reads 98 and outputs 99.

When the form refuses

Each rejection names a field and marks it invalid. An empty bound, a decimal point, a comma, more than 17 characters, or a number past -9999999999999999 or 9999999999999999 fails. A minimum above the maximum fails. Digit count has to be a whole number from 1 to 16 and quantity a whole number from 1 to 100, so 0 and 101 are both out. A no-repeats batch larger than the range fails. Fractions are not supported in either mode, and the digits field is ignored while range mode is selected.

Presets, edits and pressing again

Choosing a range preset sets the mode back to range, the minimum to 1 and the maximum to that preset. Typing in any field clears the last result and returns the status line to its ready message, so an old list never sits under new settings. During a draw the fields and the button are disabled and the status reads generating. When it finishes, the button label changes to generate again. The page keeps no copy of your batch, so pressing again starts a fresh set of draws.

What uniform really means

Uniform means every integer in the range had the same chance on each draw, not that a batch looks flat. On 1–100 a single draw lands at or below 50 half the time. With repeats allowed, two draws match 1 time in 100. Take 1–6 with quantity 4: with repeats there are 6×6×6×6, or 1,296 ordered results; with no repeats there are 6×5×4×3, or 360. Small batches stay lumpy, and nothing in the code inspects an output for balance.

How the results are printed

Each value is a string built from big integers, so all sixteen digits survive and there is no floating-point rounding and no thousands separator. Negative numbers keep their minus sign. Values appear in a numbered list in the order they were drawn, one per line, and the list markers are positions rather than part of a value. Because the digits come out plain, they need no cleanup before you paste them into a cell or a script argument.

Neighbouring pages on this site

This random number generator handles whole numbers only. /random-letter-generator/ returns one uppercase A–Z letter per draw. /random-state-generator/ picks one of the 50 US states and shows its postal code. /random-number-wheel/ spins options you type yourself, one per line, with optional integer weights from 1 to 100000, so uneven odds live there rather than here. /worksheet-generator/ builds fraction exercises for grades 3, 4 and 5, up to 30 questions per sheet.

Frequently asked questions

What is the biggest range this tool accepts?

Both bounds must be integers from -9999999999999999 to 9999999999999999, and the minimum may not exceed the maximum. A single range can therefore hold close to 20 quadrillion values, and the arithmetic stays exact because bounds are parsed as big integers rather than floats. Batch size is a separate limit: 1 to 100 numbers per press, however wide the range is.

How do I stop the same number appearing twice?

Turn on no repeats before you press generate. That setting covers only the current batch, so a later batch can produce the same values again. The quantity has to fit the range: asking for 7 numbers from 1–6 returns a message that the range has fewer unique numbers than requested, instead of a shortened list.

Can it produce decimals or negative numbers?

Negatives work in range mode. Type -50 and 50 as the bounds and a draw can land anywhere between them, minus sign included. Decimals do not work in either mode, because each bound is checked as a plain integer before use. If you need a decimal result, generate an integer and divide it yourself.

How do I get a six-digit code that starts with zero?

Digit mode cannot do it, because six digits means the block from 100000 to 999999 and shorter results are not padded. Switch to range mode with a minimum of 0 and a maximum of 999999, which spreads draws evenly across all 1,000,000 values, then add leading zeros in your own spreadsheet or script.

Why does my batch look unevenly spread?

Every draw is independent while repeats are allowed, so nothing pushes later numbers toward unused parts of the range. Ten draws from 1–100 can easily include a pair and leave most of the range untouched. Switch on no repeats if you want distinct values, or raise the quantity. The code never rebalances a finished batch.

Why do I see Could not generate a result?

That message means the draw raised an error instead of returning values. Two paths reach it: the browser does not expose crypto.getRandomValues, so the random source call fails, or one rejection sampling loop runs out of its 128 attempts. Neither path leaves partial output on the page, so check your inputs and try again.