100+ free calculators - no signup, no ads | ๐Ÿ’ฐ Financial โค๏ธ Health & Fitness ๐Ÿ“ Math ๐Ÿ”ง Other
๐Ÿ‡บ๐Ÿ‡ธ USD | About Contact

Random Integer Generator

Generate one random integer between any two values. Click Generate to get a new number instantly.

42
Random integer between 1 and 100

Multi-Number Generator

Generate multiple integers or decimals. Control duplicates, sort order, and decimal precision.

Coin Flip

Flip one or more virtual coins at once.

๐Ÿฆ…
HEADS

Dice Roller

Roll standard or custom-sided dice.

Total: 7

Random Item Picker

Pick random items from your custom list. One item per line.

Random Date Generator

Generate a random date between any two calendar dates.

What Is a Random Number?

A random number is a value drawn from a set of possible values such that each value is equally likely to be selected and no pattern or rule can predict which value comes next. True randomness requires a physical source of unpredictability - thermal noise, radioactive decay, atmospheric turbulence, or other quantum phenomena.

In computing, most random number generation uses algorithms rather than physical sources. These produce pseudo-random number sequences: deterministic outputs that pass statistical tests for randomness but are fully reproducible from a starting value called a seed. Given the same seed, a pseudo-random generator always produces the same sequence. JavaScript's Math.random() function - used by this calculator - is a pseudo-random generator, as are the RNG functions in virtually every programming language.

When Pseudo-Random Is Enough

For most practical purposes - simulations, games, sampling, lotteries, shuffling, and statistical experiments - pseudo-random numbers work well. The sequences are unpredictable in practice because the seed is drawn from the system clock or similar sources that change continuously.

For cryptographic applications such as generating encryption keys, authentication tokens, or passwords, standard pseudo-random generators are not sufficient. Use a cryptographically secure PRNG, such as the Web Crypto API (window.crypto.getRandomValues()), which sources entropy from hardware events and is designed to resist prediction even by an attacker who knows the algorithm.

How Random Integers Are Generated

Generating a random integer in the range [min, max] (inclusive on both ends) from a uniform [0,1) random float uses this formula:

floor(random() ร— (max - min + 1)) + min random() returns a float in [0, 1) Example: random integer from 1 to 6 (a die roll) floor(0.7231 ร— 6) + 1 = floor(4.338) + 1 = 4 + 1 = 5

The +1 in the range calculation ensures the maximum value is reachable. Without it, you would get integers from min to max-1.

Generating Without Duplicates

When duplicates are not allowed and you need to draw multiple unique values, the correct method is a partial Fisher-Yates shuffle of the full range:

  1. Create the complete list of integers from min to max.
  2. For each position i from 0 to count-1, swap element i with a randomly chosen element from position i to the end of the list.
  3. Take the first count elements.

This is mathematically equivalent to drawing numbered balls from a bag without replacement. Each remaining value is equally likely at each step. This calculator uses this method when the no-duplicates option is selected.

โ„น๏ธ
If you request more unique numbers than the range contains (for example, 15 unique integers from 1 to 10), it is impossible to satisfy the request without duplicates. The generator caps the count at the size of the range in this case.

Uses of Random Number Generators

ApplicationType UsedNotes
Lottery and prize drawsInteger, no duplicatesPick N winners from a pool of entries without picking the same person twice
Statistical samplingInteger, no duplicatesSelect a random sample of individuals from a numbered population
Monte Carlo simulationsDecimal, many valuesSimulate physical processes by sampling random inputs millions of times
Games and tabletop RPGDice roller, integersReplace physical dice; generate random dungeon maps, loot tables, or events
A/B testingInteger or decimalRandomly assign users to treatment and control groups
Shuffling playlistsFisher-Yates shuffleRandom item picker with all items and no repeats produces a full shuffle
Random team assignmentRandom item pickerShuffle a list of names and group the output by position
Cryptographic keysCSPRNG onlyStandard PRNGs are not safe for this purpose; use Web Crypto API
Quiz randomizationInteger, no duplicatesPick question numbers from a bank without repeating
Random date generationDate generatorTest databases, generate fictional event timelines, or pick a random deadline

Uniform vs Non-Uniform Distributions

All generators on this page produce uniformly distributed numbers: every value in the range is equally likely. Many real-world phenomena follow other distributions.

Normal (Gaussian) Distribution

Heights, test scores, and measurement errors tend to cluster around a mean with fewer values far from the centre. Generating normal random numbers from a uniform source uses the Box-Muller transform: given two uniform random numbers U1 and U2, generate Z = sqrt(-2 ln U1) ร— cos(2ฯ€ U2). The result Z follows a standard normal distribution (mean 0, standard deviation 1). Scale and shift to get any mean and standard deviation.

Exponential Distribution

Time between independent events (server requests, bus arrivals, radioactive decay) often follows an exponential distribution. Generate from a uniform U using: X = -ln(U) / ฮป, where ฮป is the rate parameter.

Why Uniformity Matters Here

For random draws, lottery picks, sampling, and shuffles, uniform distribution is exactly what you want - no value is favoured. If you are modelling a process where some outcomes are more likely than others, apply a transformation to the uniform output to match your target distribution.

Frequently Asked Questions

Are the numbers generated truly random?
No. This generator uses JavaScript's Math.random(), a pseudo-random number generator. The output is unpredictable for practical purposes and passes statistical randomness tests, making it suitable for games, sampling, simulations, and lottery draws. For cryptographic purposes such as generating passwords or encryption keys, use a cryptographically secure generator like the Web Crypto API.
What does "no duplicates" mean?
When duplicates are not allowed, each generated number appears at most once in the output, like drawing balls from a bag without replacement. If you generate 5 unique numbers from 1 to 50, all five will be different. When duplicates are allowed, each number is drawn independently and the same value can appear more than once. Use no-duplicates for lottery picks, random sampling, or shuffling.
How do I use the random number generator to pick a winner?
Two methods. First: assign each entry a number, then use the Integer Generator to pick a random number in that range - the matching entry wins. Second: type all names into the Random Item Picker (one per line), set count to 1 and no repeats, then click Pick. For multiple winners, increase the count. The Item Picker uses the Fisher-Yates shuffle to ensure each name has an equal chance.
Why does Math.random() not include the maximum value?
Math.random() returns a float in [0, 1) - it includes 0 but never reaches exactly 1. This is by design: it makes mathematical operations on ranges cleaner. To include the maximum integer, the standard formula adds 1 to the range size: floor(random() ร— (max - min + 1)) + min. This ensures max is reachable. The generators on this page use this formula, so both min and max are included in the possible outputs.