Magic Generator guide
How Random Number Generators Work
A practical guide to browser randomness, distributions, duplicates, and sampling with or without replacement.
Published and reviewed by Magic Generator · Updated
Random does not mean patternless forever
A random number generator chooses from a defined set according to a probability rule. In a uniform integer draw from 1 through 10, every integer has the same chance on each draw. That promise applies to the process, not to the appearance of a short result list. Three 7s in a row can be surprising and still be valid.
Small samples often look lopsided. Randomness does not make every group of ten draws contain each number once, and a number that has appeared recently is not automatically less likely next time. Those expectations confuse independent draws with deliberate balancing.
Pseudorandomness and browser randomness
Most software uses deterministic pseudorandom algorithms: an initial seed is expanded into a sequence that looks statistically random. Reusing the same algorithm and seed can reproduce the sequence, which is useful for simulations and seeded game worlds but unsuitable when results must be unpredictable.
Modern browsers also expose crypto.getRandomValues. It obtains random values from the browser's cryptographic random source rather than JavaScript's general-purpose Math.random. Magic Generator uses crypto.getRandomValues for its random number picker and rejects modulo-biased integer choices, so all values in the supported range receive an equal chance. This is strong browser randomness, but the tool is not a substitute for audited security software, regulated drawings, or gambling systems.
Ranges, decimals, and distributions
An integer range is discrete and inclusive here: a minimum of 1 and maximum of 100 can return either boundary. Decimal mode samples across the interval and rounds to the selected precision. Precision turns the interval into a finite collection of representable values, which matters when duplicates are disabled.
A uniform distribution is appropriate for dice-like selections. Other problems need weighted, normal, or domain-specific distributions. Choosing a random student is usually uniform; modelling adult heights is not. A random tool cannot repair a sample pool that is incomplete or biased.
With replacement or without replacement
Allowing duplicates is sampling with replacement: after a value is selected, it remains eligible. Disabling duplicates is sampling without replacement. The latter is useful for raffle positions, unique test values, or choosing several distinct page numbers.
Without-replacement requests can be impossible. There are only six unique integers from 1 through 6, so asking for seven must produce an error rather than silently repeat a value. Sorting changes only presentation after selection; it does not make the draw more or less random.
Choosing the right setup
Define the eligible population before drawing, decide whether endpoints count, and decide whether repeats are meaningful. Record those rules before a classroom selection or informal drawing so participants understand the process.
Use the Random Number Generator for games, classroom prompts, test data, and everyday choices. For consequential public drawings, use a process with appropriate independent oversight and an auditable record.