How to Generate Random Numbers Fairly
A random number is useful only when the range and the selection rules match the decision you are trying to make.
Start with the eligible set
If the options are consecutive integers from 1 through 12, an inclusive generator should give each of those twelve numbers the same opportunity to appear. If the options are instead the identifiers 2, 5, 8, and 12, drawing from 1 through 12 is not suitable; select from the actual list of eligible identifiers. Define the set before seeing any result.
For a classroom exercise, the eligible set might be the numbers 1 to 20. For a roster draw, it may be the set of valid student codes. In either case, a random function cannot compensate for missing or duplicated entries.
Decide whether repeats are permitted
A number drawn with replacement remains eligible in the next draw. If a fair six-sided die is rolled five times, seeing the same face more than once is completely ordinary. Without replacement means the drawn number is removed from the pool for the duration of that run.
Use independent repeated draws for simulations or probability lessons. Use no-repeat draws for allocating unique positions, selecting distinct quiz questions, or generating a set of separate winners from a list.
Count the possible outcomes
For an inclusive integer interval from a to b, the number of possible outcomes is b − a + 1. From 10 to 19 there are ten values, not nine. When each number is equally likely, the probability of a particular value is 1 divided by the number of outcomes.
For three unique numbers chosen from ten candidates, the order of selection matters if you assign first, second, and third positions. If the goal is merely a set of three distinct numbers, the combination is the relevant outcome. State which interpretation you need.
Use randomness without overclaiming it
A cryptographically secure browser random source is useful for everyday unbiased selection, but the outcome still depends on the integrity of the entry list, the code, and the surrounding procedure. For formal prize draws, high-stakes experiments, or legally binding decisions, additional controls and independent auditability may be appropriate.
Document the range, draw count, replacement rule, and results when reproducibility or transparency matters. If you need a repeatable seeded simulation, use a specialist tool that records a seed and algorithm; the ordinary generator here does not offer that feature.