← Converters & Math

Random Number Generator

Random numbers in any range, dice rolls from expressions like 2d6+3, coin flips, picking or shuffling a list, and random letters or hex codes.

What do you need?

1–100 1–10 0–1 decimal Lotto 6 of 49 5 of 69 10 unique to 1,000
Result
–

History (this session)

    About this tool

    This random number generator covers the everyday jobs that need a fair, unpredictable choice: a number between 1 and 100, ten unique lottery-style picks sorted low to high, a decimal between 0 and 1, a roll of 2d6+3 for a tabletop game, a run of coin flips, a winner drawn from a list of names, a shuffled order for presentations, or a random string of letters or hex digits for a temporary code. Every draw uses the browser's cryptographic random source rather than Math.random, so results are not predictable from earlier ones, and a history panel keeps your recent results in view so nothing is lost when you generate again. It is for teachers, game masters, raffle organizers, developers who need quick test data, and anyone settling a decision by chance.

    How it works

    Randomness comes from crypto.getRandomValues, which returns 32-bit integers from the operating system's cryptographically secure generator. To pick an integer in a range of size n without bias, the tool uses rejection sampling: it discards any 32-bit draw at or above the largest multiple of n that fits in 2^32, then takes the remainder, so every value in the range is exactly equally likely (a plain modulo would slightly favor small values). Decimals are produced by combining two draws into a 53-bit fraction and scaling. Unique sets use a partial Fisher-Yates shuffle over the range when the range is small and set-based rejection when it is large. Shuffling a list is a full Fisher-Yates shuffle, which produces every ordering with equal probability. Dice expressions are parsed into terms of the form NdS plus or minus modifiers, each die rolled independently, and the expected value reported as N x (S + 1) / 2 per term.

    Frequently asked questions

    Is this random number generator truly random?

    It is cryptographically secure pseudo-random: the values come from the operating system's entropy pool through the Web Crypto API (crypto.getRandomValues), the same source browsers use for encryption keys. That is far stronger than Math.random, which is a predictable algorithm seeded once per page load. For raffles, games, and sampling it is indistinguishable from true randomness; for certified lotteries you would still need audited hardware.

    How do I generate unique random numbers with no repeats?

    Tick 'No repeats' on the Numbers tab. The count cannot exceed the size of the range: you can draw 6 unique numbers from 1 to 49 but not 60. Choose a sort order if you want them low to high, as lottery tickets are printed. Without the option each draw is independent, so repeats are expected: in 10 draws from 1 to 100 there is roughly a 37% chance of at least one duplicate.

    What does 2d6+3 mean and how is it rolled?

    It is standard dice notation: roll two six-sided dice and add 3. In general NdS means N dice with S sides; a missing N means one die, so d20 is a single twenty-sided die. You can chain terms such as 1d8+1d6+2 or 4d6-1. Each die is rolled separately and shown, then the modifier is applied. The panel also reports the minimum, maximum, and average of the expression; 2d6+3 ranges from 5 to 15 with an average of 10.

    Can I pick a random winner from a list of names?

    Yes. On the List tab paste one entry per line, set how many to pick, and choose whether the same entry may be picked twice. Blank lines are ignored and duplicates are kept as written, so a name entered twice has twice the chance. Use Shuffle to put the whole list in a random order instead, for example to set a speaking order or split people into groups by taking the first half and second half.

    Related tools

    Unit Converter · Temperature Converter · Cooking Converter · Percentage Calculator · Roman Numeral Converter · Number to Words · Fraction Calculator · GPA Calculator · Average Calculator · Ratio Calculator

    Browse all Unit Converters & Everyday Math, or go back to every free tool on HeroYears.