Random Number Generator
Generate random integers, floats, lists, UUIDs, and secure passwords. Set min/max ranges and count — fully client-side.
How to Use Random Number Generator
- 1Select the type of random number (integer, float, list, etc.).
- 2Set the minimum and maximum values.
- 3Choose how many numbers to generate.
- 4Click Generate and copy the results.
Zenovay
Privacy-first analytics for your website
Understand your visitors without invasive tracking. GDPR compliant, lightweight, and powerful.
Related Tools
CSS Gradient GeneratorCreate beautiful CSS gradients with a visual editor. Linear, radial, and conic gradients.
CSS Box Shadow GeneratorDesign CSS box shadows with visual controls. Adjust offset, blur, spread, and color.
CSS Border Radius GeneratorCreate custom border radius values with visual controls. Link or unlink corners for quick adjustment.
CSS Flexbox PlaygroundLearn and generate CSS Flexbox layouts visually. Adjust direction, alignment, wrapping, and gap in real time.
Frequently Asked Questions
What is the difference between Math.random() and crypto.getRandomValues()?▾
Math.random() is a pseudo-random number generator (PRNG) seeded with system state. It is fast and suitable for simulations, games, and shuffles — but NOT for security purposes like passwords, tokens, or keys, because it is predictable given the seed. crypto.getRandomValues() is a cryptographically secure PRNG (CSPRNG) backed by the OS entropy source. Always use it for anything security-sensitive.
How do I generate a random integer in a range in JavaScript?▾
For a random integer between min and max (inclusive): Math.floor(Math.random() * (max - min + 1)) + min. For cryptographically secure integers: const arr = new Uint32Array(1); crypto.getRandomValues(arr); const result = (arr[0] % (max - min + 1)) + min. Note the modulo bias for large ranges — for bias-free results, reject and retry values that fall outside an even multiple of the range.
What are common uses for random number generation?▾
Common uses: dice rolls and games, statistical sampling, A/B test group assignment, random ordering and shuffling, generating test data and fixtures, creating unique IDs and nonces, selecting random items from a list, Monte Carlo simulations, and cryptographic key generation. The appropriate randomness quality depends on the use case — games need speed, security needs unpredictability.
How do I generate a unique random list without duplicates?▾
To generate N unique random numbers from a range: start with all possible values, shuffle them with the Fisher-Yates algorithm, and take the first N. Fisher-Yates: for i from n-1 down to 1, swap array[i] with array[randomInt(0, i)]. This is O(range) not O(n), so it only works when the range is manageable. For large ranges, use a set and repeatedly generate until you have enough unique values.
What is a normal distribution and when should I use it?▾
A normal (Gaussian) distribution generates values clustered around a mean, with most values within one standard deviation (68%) and nearly all within three (99.7%). Use it when simulating real-world phenomena that cluster around an average — heights, test scores, measurement errors. Generate normal variates with the Box-Muller transform: z = sqrt(-2 * ln(u1)) * cos(2 * pi * u2), where u1 and u2 are uniform random numbers.