Skip to main content
CalcMax

Random Number Generator

Range: 1 – 200

Range: 0 – 4,294,967,295

Result

63, 1, 53, 99, 97

Numbers drawn

Possible values
100
Chance of at least one repeated number
9.65%

A random number generator turns a starting point into a list of whole numbers inside a range you set. This one takes a range, how many numbers you want and the random seed to start from, and gives back exactly that many integers — the same ones every time you use the same seed, which is what makes a list you can hand to someone else and have them reproduce. Turn duplicates off and the result becomes a selection rather than a sequence, so no value can come up twice; leave them on and the numbers are independent draws, which is the honest model for a die, a lottery machine or a shuffled playlist that might repeat. The panel also reports how many different values the range holds and how likely a repeat would be if duplicates were allowed.

Formula

next = (state + 0x6D2B79F5) mixed by multiply-shift → value = minimum + ⌊next × (maximum − minimum + 1)⌋

seed
The starting state of the generator, any whole number from 0 to 4294967295. It is not a source of randomness by itself — it is the point the sequence begins at, which is exactly why the same seed always gives the same list
state
The running state, updated once per number. The update mixes the state with a fixed constant and a few multiply-shift steps; the mixing is what makes consecutive values look unrelated, and it is the step that would break first if it were simplified
minimum, maximum
The endpoints of the range, both included. The width of the range is what the fraction gets scaled by, so every whole number in the range has the same chance
⌊ ⌋
Rounding down. The generator produces a fraction in [0, 1) and the floor turns it into one of the whole numbers in the range
count
How many numbers to produce, up to 200. With duplicates off it may not exceed the width of the range, because a selection cannot be longer than the pool it comes from

Use it when you need a list rather than a single number: a sample to check by hand, a set of test cases that has to be the same on every run, a draw you want to be able to re-run in front of an audience, or placeholder data. The ability to fix the seed is the reason to prefer this over whatever random function your language ships with — a seed turns a one-off result into something you can share, re-check and argue about. Reach for it with duplicates off when the same item must not appear twice, which is the shape of a lottery draw, a random sample of a list and a shuffled order. Two things it is not for: it is not a source of unpredictable numbers, so nothing that has to be unguessable belongs here; and it is not a substitute for a statistical random sample of a real population, because it knows nothing about the population, only about the range.

Worked examples

  1. Five numbers from 1 to 100, and the same five again

    1. The range 1 to 100 holds 100 different values, so each draw is one of 100
    2. The seed 1 fixes the starting state; each of the five numbers updates it once
    3. Rounding each fraction down into 1 to 100 gives 63, 1, 53, 99 and 97 in that order

    Those five numbers are not a coincidence and not a stored table: they are what the seed 1 produces, and typing 1 into the seed field again reproduces them exactly. Notice that the 9.65% is a statement about the range and the count, not about this particular draw — with five draws from a hundred values there is a little under a one in ten chance that two of them match, whether or not any two in this list happen to. Changing the seed to 7 gives a completely different list while leaving that percentage untouched, which is the cleanest way to see which part of the panel is random and which part is arithmetic.

  2. Six numbers from 1 to 49 with repeats forbidden

    1. The pool is 49 values and six are drawn without replacement
    2. Each new number is redrawn until it is one the pool has not already given up, which is why a value can never appear twice
    3. Reading the list in the order it was produced gives 23, 16, 33, 31, 8 and 11

    Switching duplicates off does not change the 27.26%, and that is the point of reporting it next to this example: it is the chance that six draws from 49 would have collided if repeats had been allowed, which is the same whether or not you forbade them. It is also what makes a no-repeat draw expensive at large counts — at 49 values and 6 draws, more than a quarter of unrestricted draws would repeat something, and by 23 draws from 365 the figure is over half. The numbers stay in the order they were drawn rather than being sorted, so that the same seed and the same settings always reproduce the same list.

  3. A range with only one value in it

    1. The range holds exactly one value, so every draw is that value
    2. The repeat chance is the chance that four draws collide, and with a pool of one they must
    3. The result is 7, 7, 7 and 7

    This is the edge where the random number generator stops being random and becomes a constant, and it is worth keeping in mind because it is the only case where the output is fully predictable before you press anything. It also marks the boundary of the no-repeat mode: with the same range, asking for two numbers without duplicates is an impossible request rather than a short list, and the page says so instead of quietly returning one number.

Limitations

These numbers are not suitable for anything that has to be unguessable. The generator is a small, fast, seeded arithmetic sequence of the kind built into ordinary software: given the seed, anyone can reproduce the entire list, and given a few values from it, the rest can be worked out. That rules it out for passwords, keys, tokens, one-time codes, lotteries with money attached and anything else where a participant must not be able to predict or reconstruct the draw. For those, a cryptographic random source is the only correct answer. The repeat chance is also not a claim about the list you are looking at: it is the probability that a draw of that size from that pool would contain at least one collision, computed as if the draws were independent and uniform, and it is reported whether or not duplicates were allowed. Its practical meaning is the one that catches people out — a collision needs only about the square root of the pool size to become likely, so 23 draws from 365 dates already exceed an even chance. And the count is capped at 200 per run, with no repeats impossible once the count exceeds the pool.

Frequently asked questions

Are these numbers safe to use in a lottery, a password or a security token?
No. This generator is a small seeded arithmetic sequence of the kind ordinary software uses, not a cryptographic one: from the seed, the whole list can be reproduced, and from a few of its values the rest can be worked out. Anything where a participant must not be able to predict or reconstruct the result — lotteries with money attached, passwords, keys, tokens, one-time codes — needs a cryptographic random source instead. For draws, samples, games and test data, where reproducibility is a feature rather than a leak, it is the right tool.
What is the seed for, and why do I get the same numbers every time?
The seed is the state the sequence starts from, so the same seed always produces the same list. That is deliberate: it makes the result reproducible, which is what you want when you need to hand a sample to someone else, re-run a draw in front of an audience, or keep a test case from drifting. Change the seed and you get a different list from the same settings. If you want the numbers to differ every time, change the seed between runs — the value you type is recorded with the result, so a list you liked can always be recovered.
Why can duplicates still appear when they are allowed?
Because each draw is independent. With duplicates allowed, every position picks one of the values in the range without regard to what the other positions picked, which is the honest model for a die roll or a lottery machine that puts its ball back. The repeat chance on the panel is exactly the probability that at least one pair collides — about 9.65% for five draws from a hundred values, and over 50% once you draw 23 values out of 365. Turn duplicates off when the same value must not appear twice, which is the shape of a raffle, a sample of a list or a shuffled order.
Does the repeat chance get smaller if I forbid duplicates?
No, and the panel keeps showing the same number on purpose. It answers the question you are actually asking when you flip that switch: how likely a collision would have been if repeats were permitted. For six numbers from 1 to 49 that is 27.26%, so forbidding duplicates removes a real risk rather than a theoretical one. It also explains why a no-repeat draw gets slow and eventually impossible at large counts — once the count exceeds the number of values in the range there is no valid answer at all, and the page reports that instead of returning a shorter list.
How many numbers can I generate at once, and over what range?
Up to 200 numbers per run, and the endpoints of the range must be whole numbers with the minimum no larger than the maximum. The values themselves can be negative, so a range from −50 to 50 is fine. Non-integer endpoints are rejected rather than rounded: with duplicates forbidden, drawing from a range that holds fractions would make the no-repeat rule an empty condition, and a list that looks plausible while quietly ignoring its own setting is worse than an error message.
Are the numbers sorted?
No — they are printed in the order they were drawn, and that order is part of the result. Sorting would throw away information that the same seed is supposed to reproduce, and it matters for anything where position is meaningful, such as assigning a shuffled order or dealing a hand. If you want an ordered selection, sort the list yourself after copying it; the draw itself stays faithful to the sequence the seed produced.

References

Related calculators