Random Number Generator

Share:

Generate truly random numbers, sequences and picks using crypto.getRandomValues(). Free, instant, no signup. For games, decisions and statistics.

RT-FUN-002 · Fun & Misc
Your browser is too old for this tool’s interactive features. Please update to Safari 13.1, Chrome or Edge 80, Firefox 74 or newer.

Random Number Generator Tool

Last 10 Results (click to copy)

Advertisement
After results · AD-W1 Responsive · Post-tool — peak engagement

How to Use the Random Number Generator

Choose your mode

Select Single for one number, Range for multiple numbers in a batch, Sequence for ordered sets with a defined step, or Pick from List to randomly select from your own items.

Set your parameters

Enter your minimum and maximum range, set how many numbers you need, or paste your list of items — one per line. Adjust toggles for duplicates, sorting, or shuffling.

Click Generate

Your random result appears instantly with a brief count-up animation. All randomness uses crypto.getRandomValues() — the same cryptographic standard used in security software.

View history and copy

In Single mode, your last 10 results are saved below the generator as clickable pills — tap any pill to copy that number to your clipboard. In Range and Sequence modes, use Copy All to grab your full output.

Advertisement
After how-to · AD-W2 Responsive

True Randomness vs Pseudo-Randomness — Does It Matter?

True Randomness vs Pseudo-Randomness: Does It Matter?

When you generate a random number on a computer, you are almost never getting a truly random number in the physical sense. Traditional computer random number generators are pseudo-random: they use a deterministic mathematical algorithm that starts from an initial value called a seed. Given the same seed, the same algorithm always produces the exact same sequence of numbers — which means the output is predictable if you know the seed and algorithm. Common algorithms include the Mersenne Twister, published by Makoto Matsumoto and Takuji Nishimura in 1998 and used in Python's random module, and XorShift (used in some JavaScript engines behind Math.random()). These are fast and statistically well-distributed, but they are not unpredictable.

True randomness, by contrast, is derived from physical phenomena that are inherently unpredictable: thermal noise in electronic circuits, quantum tunnelling events, radioactive decay, or atmospheric noise. Generating random numbers from these sources is slower, but the output cannot be predicted or reproduced even if you have full knowledge of the system. The browser's crypto.getRandomValues() API sits in between — it uses the operating system's Cryptographically Secure Pseudo-Random Number Generator (CSPRNG), which is seeded from physical entropy (thermal noise on Windows via CNG, /dev/urandom on Linux, and SecRandomCopyBytes on macOS). The OS continuously replenishes this entropy pool, making crypto.getRandomValues() effectively unpredictable for all practical purposes.

Why does this distinction matter? For recreational purposes — rolling dice in a board game, picking raffle winners, generating test data — pseudo-random algorithms like Math.random() are perfectly adequate. But for security-critical applications like generating passwords, cryptographic keys, or session tokens, a predictable RNG is a catastrophic vulnerability. Early online poker sites were compromised precisely because their card shuffling used weak pseudo-random seeding, allowing attackers who knew the algorithm and approximate seed time to predict the entire deck.

"Early online poker sites were hacked because their 'random' card shuffling used predictable pseudo-random algorithms — true cryptographic randomness would have prevented millions in losses."

How Lotteries Keep Draws Fair (Including Singapore Pools)

National lotteries face a high standard for fairness: a draw has to be unpredictable, and the public has to be able to see that it was. Singapore Pools draws its 4D and TOTO numbers with mechanical draw machines, not software. Under its published draw process, a computer only picks at random which draw machine and which ball set will be used. Each ball is then weighed and must fall within an accepted weight variance, and the balls are loaded into the machine in front of the audience. A representative of an independent public accounting firm is present from the unsealing of the equipment room to the verification of the results, and members of the public may attend.

Large US lotteries such as Powerball and Mega Millions also use physical ball-draw machines rather than electronic RNG, partly for tradition and public trust, and partly because physical draws are trivially verifiable by anyone watching on live television. However, these machines must meet strict tolerances for ball weight and air pressure uniformity. The infamous Pennsylvania Lottery "Triple Six Fix" scandal of 1980 demonstrated what happens when physical draw integrity is compromised: lottery insider Nick Perry weighted most ping-pong balls so only 4s and 6s could emerge, fixing the winning combination to 6-6-6 and collecting on pre-purchased tickets. Modern lotteries use multi-party observation, video recording, and statistical audit trails to prevent such manipulation. RNG-based lotteries have an additional advantage: every single draw can be cryptographically logged and verified after the fact, leaving a complete audit trail.

Random Sampling in Statistics and Research: An ASEAN Perspective

Randomness is not just for games and lotteries — it is the mathematical foundation of modern empirical science. In survey research and statistics, random sampling is the process of selecting a subset of individuals from a population such that every individual has an equal (or known) probability of selection. This ensures that findings from the sample can be generalised to the broader population with quantifiable confidence.

Singapore's Department of Statistics (SingStat) uses stratified random sampling for national surveys such as the General Household Survey and the Household Expenditure Survey — dividing the population into demographic strata (age, income bracket, dwelling type) and randomly sampling within each stratum to ensure proportional representation. Indonesia's Badan Pusat Statistik (BPS) employs two-stage cluster sampling in its national census and economic surveys: first randomly selecting geographic clusters (villages or census blocks), then randomly sampling households within each cluster. This approach is necessary for a country of 270 million people spread across 17,000 islands, where a pure simple random sample would be prohibitively expensive to administer.

At a research level, randomised controlled trials (RCTs) — the gold standard of clinical and social science research — depend entirely on random assignment to ensure that treatment and control groups are comparable. University researchers, in Singapore as elsewhere, typically use computer-generated random assignment for behavioural experiments and clinical trials. In finance, banks and regulators use Monte Carlo simulation, which runs thousands of randomised scenarios, as one way to model tail risks. A large simulation can consume millions of random numbers, so the quality of the underlying generator matters to the result.

Nothing here is random, and what the browser does instead

01

There are no truly random numbers in traditional computing — computer-generated numbers are "pseudo-random," produced by deterministic mathematical algorithms that appear random but are completely reproducible given the same seed.

02

The web's crypto.getRandomValues() function uses the operating system's cryptographically secure PRNG (CSPRNG) — seeded by physical entropy sources like thermal noise in your device's hardware.

03

Singapore Pools draws 4D and TOTO numbers with mechanical draw machines, not a random number generator. The balls are weighed before each draw, and an independent public accounting firm witnesses the whole process.

04

The Mersenne Twister algorithm (Matsumoto and Nishimura, 1998; used in Python's random module) has a period of 219,937−1 — meaning it cycles only after generating roughly 106,001 numbers. For comparison, the number of atoms in the observable universe is about 1080.

05

Math.random() in JavaScript is not suitable for security or gambling applications — its internal state can potentially be reconstructed from observed outputs, making it cryptographically weak.

06

In 1999, researchers at Reliable Software Technologies (Arkin et al.) showed that the shuffle used at the PlanetPoker cardroom, seeded from the server's clock, could be narrowed to about 200,000 possible decks. Knowing five cards was enough to work out the rest of the deal.

07

The Birthday Problem shows that in a group of just 23 people, there is a greater than 50% probability that two share a birthday — a classic illustration of how human intuition about randomness and probability is systematically wrong.

08

Random sampling is the foundation of survey research — Singapore's Department of Statistics uses stratified random sampling to ensure that national surveys represent all demographic groups in accurate proportions.

09

Monte Carlo simulation uses random number generation to model complex systems with many uncertain variables, from engineering tolerances to financial risk, by running the same model across thousands of randomised scenarios.

10

Quantum random number generators (QRNGs) harness quantum mechanics — photon polarisation, radioactive decay timing, or vacuum fluctuations — to produce numbers that are provably unpredictable. These are used in high-security cryptographic and government applications.

📅 Research current as of 01 Oct 2026 · Sources: W3C. Web Cryptography API, W3C Recommendation 26 January 2017 — getRandomValues: https://www.w3.org/TR/2017/REC-WebCryptoAPI-20170126/; Barker E, Kelsey J. Recommendation for Random Number Generation Using Deterministic Random Bit Generators. NIST Special Publication 800-90A Revision 1, June 201
Standards, published formulas, and reference data are revised over time — check against a current authoritative source before relying on these figures.

Frequently Asked Questions

  • This generator uses crypto.getRandomValues(), which draws from your operating system's Cryptographically Secure Pseudo-Random Number Generator (CSPRNG). The OS seeds its CSPRNG from physical entropy sources such as thermal noise and hardware events, making the output practically unpredictable. While technically still "pseudo-random," it is indistinguishable from true randomness for all real-world purposes and is the same standard used in password managers, SSL/TLS encryption, and security-grade software.
  • Math.random() is a simple pseudo-random generator optimised for speed, not security. Its internal state can potentially be reconstructed by observing enough outputs, making it predictable. crypto.getRandomValues() uses the OS-level CSPRNG, which is seeded from genuine physical entropy and is designed to be computationally infeasible to predict — even with knowledge of previous outputs. For games and casual use, both work fine. For anything security-related (passwords, tokens, IDs), always use crypto.getRandomValues().
  • It does not use a random number generator for the winning numbers. According to Singapore Pools' published lottery draw process, 4D and TOTO numbers come from mechanical draw machines. A computer only picks at random which draw machine and ball set will be used. Each ball is weighed and must fall within an accepted variance, the balls are loaded into the machine in front of the audience, and a representative of an independent public accounting firm witnesses the whole process and verifies the result before it is released. Members of the public can attend the draws.
  • A seed is the initial value fed into a pseudo-random number generator algorithm. Given a fixed seed, the algorithm always produces the same sequence of "random" numbers — this is actually useful in simulation and gaming, where reproducibility is needed. A random number is simply the output of the generator. In cryptographically secure systems, the seed itself is derived from genuinely unpredictable physical entropy, so even if you know the algorithm, you cannot reproduce the output without knowing the secret seed.
  • Yes — for informal draws such as office raffles, class prize selections, or team assignments, this tool provides results that are cryptographically fair. Use "Pick from List" mode: paste all participant names (one per line), set how many to pick, disable replacement, and click generate. All selections are made using crypto.getRandomValues(), which eliminates bias. For high-stakes or legally binding lotteries with significant prize values, a certified third-party draw service with an independent audit trail is recommended.
  • Pick from List lets you randomly select one or more items from any custom list you provide. Common uses include: picking raffle winners from a list of entrant names, randomly assigning team members to tasks or groups, determining a random speaking order or queue, selecting a random restaurant or activity from a list of options, assigning random roles in a game, or any situation where you need a fair, unbiased selection from a defined set of choices.
  • The Birthday Problem is a famous probability result: in a group of just 23 randomly chosen people, there is greater than a 50% chance that two share the same birthday — despite there being 365 days in a year. By 70 people, the probability exceeds 99.9%. This counterintuitive result arises because we are asking about any pair sharing a birthday, not a specific birthday. The Birthday Problem has practical implications in cryptography: it explains why hash functions need very long outputs to resist "birthday attacks," where an attacker searches for two inputs that produce the same hash.
  • In Range mode, you can generate up to 1,000 numbers at once. In Sequence mode, sequences up to 10,000 numbers are supported (use a larger step size to stay within this limit for very wide ranges). In Pick from List mode, you can pick as many items as are in your list. All computation runs entirely in your browser — no data is sent to any server — so performance is instant on any modern device.
  • No. All random number generation happens entirely within your browser using JavaScript. No numbers are sent to RECATOOLS servers, stored in any database, or logged anywhere. The history display of your last 10 Single-mode results exists only in the browser's memory for the current session — it disappears when you close or refresh the page. RECATOOLS does not collect the content of what you generate.
  • A Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) is a random number generator that satisfies two cryptographic properties: (1) its output passes all statistical tests for randomness, and (2) given knowledge of its past outputs, it is computationally infeasible to predict future outputs or reconstruct its internal state. These properties are essential for any security application — generating passwords, encryption keys, session tokens, or digital signatures. Standard PRNGs like Math.random() satisfy property 1 but not property 2. The OS CSPRNG (accessed via crypto.getRandomValues()) satisfies both.

Method & sources

How it computes

Integers are drawn uniformly by the shared cryptographic kernel: enough random bytes from crypto.getRandomValues for the range, rejection sampling to remove modulo bias, and exact (BigInt) arithmetic for ranges wider than 48 bits. Range mode draws independently or, with duplicates disallowed, Fisher–Yates-shuffles the full range and takes the first n; Sequence mode enumerates start → end by step (optionally shuffled); Pick mode selects from the pasted list with or without replacement.

What this tool implements

  • Source of randomness: the W3C Web Cryptography API getRandomValues (the operating system's CSPRNG); Math.random is never used.
  • Uniformity: rejection sampling; above 2^48 the accumulator, rejection threshold and modulus are computed in BigInt so no low-order bits are lost.
  • Shuffles use the Fisher–Yates algorithm with a cryptographic index draw.
  • Limits: Range mode 1–1,000 numbers, Sequence mode up to 10,000 values, single-number span at most 10^15.

Sources

  • W3C. Web Cryptography API, W3C Recommendation 26 January 2017 — getRandomValues: https://www.w3.org/TR/2017/REC-WebCryptoAPI-20170126/
  • Barker E, Kelsey J. Recommendation for Random Number Generation Using Deterministic Random Bit Generators. NIST Special Publication 800-90A Revision 1, June 2015. doi:10.6028/NIST.SP.800-90Ar1
  • Matsumoto M, Nishimura T. Mersenne Twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation 1998;8(1):3-30. doi:10.1145/272991.272995
  • Arkin B, Hill F, Marks S, Schmid M, Walls TJ, McGraw G. How We Learned to Cheat at Online Poker: A Study in Software Security. Reliable Software Technologies, September 1999: https://gwern.net/doc/cs/cryptography/2006-arkin.pdf
  • Singapore Pools. Lottery Draw Process — mechanical draw machines, weighed ball sets, draws witnessed by a public accounting firm: https://online.singaporepools.com/en/lottery/lottery-draw-process

What can make this go out of date

  • none at runtime
Advertisement
Pre-footer · AD-W3 728 × 90