Integer random number generator
An integer random number generator draws whole numbers from a closed range. It will not emit halves unless you switched it to real numbers, which this query is not asking for.
How it works
You set a lowest integer and a highest integer. The generator assigns each integer in that closed span a chance to appear. On a fair picker those chances are equal. The output is a whole number, written without a fractional part. A trailing .0 is a costume. Ask the tool which type it actually drew.
This is a number generator with a type constraint, not a different species of chance. The integer part is the constraint. People reach for it when a decimal would be meaningless: seats, tickets, dice faces, array indexes, days in a month you already named. A real-number generator is the wrong sibling for those jobs because 3.7 is not a seat.
Page widgets are typically algorithmic. That is enough for a class, a game, or a sample row. A prize with rules, a secret, or a nonce needs a generator and a process built for those stakes. The word “integer” does not upgrade the stakes. It only forbids fractions.
Whole numbers, not a disguised decimal
If you need 1, 2, 3, 4, or 5, you need five integers. Rounding a real number after the draw is a different method and can pile results on some faces. Do not draw a real number in [1, 5] and round, then call the result a fair integer from 1 to 5, unless you have checked how the rounding treats the edges. Set the tool to integers and skip the costume.
Integers: counting numbers in the span, including negatives if you allowed them. Reals: a continuous span; the wrong type for seats and tickets. With replacement: the next integer may match the last. Without replacement: a deal from the remaining span, until the span is empty.
Negatives are legal if the minimum is negative. Zero is legal if it sits inside the span. A generator that “never returns zero” while zero is inside the span is either broken or filtered. Filtering after the draw changes the weights. If you did not want zero, raise the minimum.
Record the type with the draw
A useful note says “integers from A through B inclusive, N draws, repeats allowed or not.” That note can be replayed as a method even if the next numbers differ. A note that says “we used a random number generator” cannot. The integer constraint is easy to lose in conversation: someone will later assume decimals were allowed, or that 0 was impossible. Write the type down.
An integer generator that keeps printing .5 is not strict. It is a decimal tool in a whole-number hat. When you need unique tickets, deal. When you need independent rolls, roll. When you need names, paste names; encoding people as integers is extra work and extra ways to miscount. The generator is good at integers. It is average at remembering what the integers stood for. That part is your legend, kept beside the output.
Questions and answers
- Will this return 3.5?
- Not if it is truly an integer generator. If you see fractions, you are on a real-number mode or a display that is lying about type.
- Is zero allowed?
- Yes, when zero sits between the minimum and the maximum you set. Raise the minimum if you do not want it.
- Are repeats a bug?
- Not on independent draws. Turn on a no-repeat or shuffle mode if you need each integer at most once.
Related guides
Address random generator
An address random generator builds a fake street line so you do not invent one by hand. Searches for random address generator, address generator random, and a New York variant still want a sample, not
Alphabet random generator
An alphabet random generator shuffles the letters of an alphabet into a new order. For English that is a permutation of A through Z, each letter once.
Animal generator random
An animal generator random pick is one animal name drawn from the tool’s list. Each click returns one animal from that list, not a living creature and not a complete catalog of Earth.