Random Number Generator
Generate random numbers in any range. Single or multiple numbers, integers or decimals.
About the Random Number Generator
Random numbers are needed everywhere - from unbiased sampling in research to fair prize draws, game mechanics, simulations, and cryptographic key generation. This generator uses your browser's cryptographically secure random number source (the Web Crypto API), producing results that are statistically uniform and unpredictable. Every value in your specified range has exactly equal probability of being selected, with no hidden biases or patterns.
Human beings are surprisingly bad at generating random numbers mentally. Studies consistently show that people avoid repeating numbers ('that can not happen twice in a row'), favour certain positions ('the middle of a range feels more random'), and cluster choices around 'lucky' numbers. These intuitive biases make human-generated 'random' choices predictable - a problem in everything from security questions to research sampling. A cryptographic RNG has no such biases: it has no memory of previous results and no preference for any value in the range.
The range of practical applications is wider than most people realise. Statistical sampling for surveys (selecting 100 respondents from 10,000), prize draws for Instagram giveaways, team formation for sports or hackathons, selecting random test cases for quality assurance, generating OTP-like numbers for educational use, simulating dice and card draws for board game testing - all of these require genuinely random numbers, and all of them are served by the same simple interface here.
Random Number Generation
Integer in [min, max] = floor(crypto.random x (max - min + 1)) + min
crypto.getRandomValues() provides true cryptographic randomness suitable for security applications - Uniform distribution: every number in range has equal 1/(max-min+1) probability - No repetition mode: shuffle all values in range using Fisher-Yates, return one by one
Worked Example
Prize draw from 50 participants (numbered 1-50)
Random draws: 23, 7, 41 - All unique, all equally probable - Each had a 1/50, 1/49, 1/48 chance respectively
Tips & Insights
- 1
For prize draws and raffles, perform the generation live in front of participants or record the screen. Transparency prevents accusations of manipulation - a visible real-time draw is more trustworthy than a pre-generated result shown after the fact.
- 2
Statistical sampling for research: use the 'no duplicates' mode to ensure each population member is selected at most once. Enable unique numbers, set range to your population size, and generate the required sample size in one step.
- 3
Dice rolling simulation: set range 1-6, count 1, and use the Re-roll button to roll again without changing settings. This is faster than any physical dice for rapid prototyping of game mechanics or RPG encounters.
- 4
For team formation at events, hackathons, or sports days, generate a random ordering of all participants by setting range 1 to participant count, enabling no-duplicates mode, and generating all numbers. The result is a random sequence for team assignment.
- 5
Decimal mode is useful for Monte Carlo simulations, probability experiments, and generating test data. Set range 0-1 with 4 decimal places to generate uniformly distributed probabilities for simulation inputs.
- 6
The 'no duplicates' mode uses the Fisher-Yates shuffle algorithm, which generates a perfectly uniform random permutation. This is mathematically superior to repeatedly generating numbers and discarding duplicates, especially for large ranges where duplicates would be frequent.
- 7
For Instagram and social media giveaways, number your eligible comments sequentially, then use this generator with that range and no duplicates to select winners. Screenshot the generation interface as proof of fairness before announcing.
Why this matters for you
Fairness in selection processes - prize draws, sampling, team formation, turn order - requires genuine randomness that humans cannot replicate intuitively. The biases in human-generated 'random' choices are well-documented: we avoid numbers that just appeared, we favor round numbers and midpoints, and we unconsciously select familiar values. A cryptographic RNG is free of all these tendencies, producing selections that are statistically indistinguishable from ideal randomness.
In scientific research, sampling bias is one of the most common sources of invalid conclusions. If you survey 100 people out of 10,000 but choose them based on who is easiest to reach, who volunteered, or who you personally selected, the results are not representative. True random sampling - enabled by a trustworthy RNG - is a foundational requirement for research validity, from school projects to academic papers.
The use of cryptographic randomness rather than pseudo-random algorithms matters for security applications. JavaScript's Math.random() is deterministic and predictable given a known seed - it should never be used for security-sensitive random generation like OTPs or tokens. The Web Crypto API used here provides randomness from hardware entropy sources, meeting the same standard required for cryptographic key generation. For educational purposes, security demonstrations, and test data generation, this tool provides the right quality of randomness.
Related Calculators
Password Gen
Generate strong, random passwords with customizable length, uppercase, numbers, and special characters.
Average
Calculate mean, median, mode, and range from any list of numbers. Paste a dataset and get all statistics instantly.
Percentage
Calculate percentages instantly - find X% of Y, percentage change, add or subtract percentages.