Random Number Generator
Generate results with the Random Number Generator — set your parameters and get cryptographically-random output instantly.
Random Number Generator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: floor(Math.random() × (max - min + 1)) + min
Worked example — e.g. 73
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer · Editorial policy
Random Number Generator Formula
floor(Math.random() × (max - min + 1)) + min
Math.random() returns a float in [0,1). Multiply by the range size and add the minimum to get a uniformly distributed integer in [min, max].
Random Number Generator — Worked Examples
Example 1: Single random number 1-100
Problem:Min: 1, Max: 100, Count: 1
Solution:floor(Math.random() × 100) + 1
Result:e.g. 73
Example 2: 5 lottery numbers 1-49
Problem:Min: 1, Max: 49, Count: 5
Solution:5 independent draws each uniformly distributed in [1,49]
Result:e.g. 7, 23, 31, 42, 48
Random Number Generator — Frequently Asked Questions
Is Math.random() truly random?
No. Math.random() is a pseudo-random number generator (PRNG) — it uses a deterministic algorithm seeded internally by the browser. The output appears random and passes statistical tests, but it is not cryptographically secure. For passwords, tokens, or security-sensitive values, use crypto.getRandomValues() instead. For games, simulations, and lotteries, Math.random() is perfectly adequate.
What is the difference between random and pseudo-random?
True random numbers derive from physical phenomena — radioactive decay, thermal noise, atmospheric static — and are fundamentally unpredictable. Pseudo-random numbers are produced by algorithms: given the same starting seed, the sequence repeats identically. Modern PRNGs like xorshift128+ (used in V8 for Math.random()) produce sequences that are statistically indistinguishable from true random for most practical purposes.
How to pick random lottery numbers?
Set Min to 1 and Max to the highest number in your lottery (e.g., 49 for most 6/49 lotteries), then set Count to how many numbers you need (e.g., 6). Each generated number is independently chosen from the full range. Note: since the lottery draw is also random, using a random generator gives you the same statistical odds as any other selection method.
What is a fair random number generator?
A fair RNG produces each number in the range with equal probability — a uniform distribution. This generator uses the formula: floor(Math.random() × (max - min + 1)) + min, which gives every integer in [min, max] an equal 1/(max-min+1) chance. Fairness can be verified by generating a large sample and confirming each value appears roughly equally often.
What are common uses for random number generators?
RNGs are used in games (dice rolls, card shuffles, procedural generation), statistical sampling (picking survey respondents, A/B test assignment), simulations (Monte Carlo methods, physics engines), lotteries and raffles, cryptographic key seeding, load balancing, and scientific research requiring randomized controlled trials.
Random Number Generator — Background & Theory
History of the Random Number Generator
Related Calculators
🔐Password Generator
Generate secure random passwords
🎯Cluster Finder (K-Selection)
Determine optimal number of clusters using Elbow, Silhouette, and other methods
🧮P-Value from Z Calculator
Calculate pvalue from zcalculator with inputs, formulas, and instant results.
🧮Regression Coefficient Calculator
Calculate regression coefficient with inputs, formulas, and instant results.
🧮Relative Risk Calculator
Calculate relative risk with inputs, formulas, and instant results.