Random number, name picker and group maker

Generate random numbers with or without repeats, draw winners from a list over several rounds, or split names into balanced random groups, using the browser’s secure random numbers.

  • Runs locally
  • Free

Use the tool

Your files are processed in your browser and are not uploaded to a server.

About this tool

A random number, name picker and group maker in one page: generate random integers in any range (with or without repeats, optionally sorted), draw winners from a pasted list over several rounds with drawn names removed from the pool, or split a list into balanced random groups. Randomness comes from the browser’s crypto.getRandomValues, with rejection sampling and a Fisher–Yates shuffle so every name and every number has exactly the same chance.

Typical uses

  • Run a prize draw in rounds at a party or event, with a record of each round
  • Pick students at random or split a class into equal teams
  • Generate unique random numbers between 1 and 100 or any other range

How to use

  1. Choose random numbers, draw names or split into groups. For numbers enter the min, max and how many; for names and groups paste one name per line.

  2. Generate, draw or split. Draws can run several rounds with a visible history; copy any result, download numbers as TXT and groups as CSV.

Good to know

Numbers from -1000000000 to 1000000000, up to 10000 at a time; lists up to 10000 names. Uses crypto.getRandomValues with rejection sampling, so every outcome is equally likely. Lists are neither uploaded nor saved, and the draw history is lost on reload.

How every outcome gets the same chance

A fair draw needs three steps without bias: where the randomness comes from, how it becomes a whole number in a range, and how a list is shuffled. This is how the tool handles each.

  1. Source: the browser’s crypto.getRandomValues. MDN describes it as returning cryptographically strong random values from a generator seeded with enough entropy, while Math.random does not provide cryptographically secure random numbers. If the browser lacks it, the tool says so instead of falling back to Math.random.
  2. Whole numbers: each step takes a 32-bit random value (0 to 2^32 − 1). To pick one of n outcomes it accepts only values below the largest multiple of n, draws again otherwise (rejection sampling), and then takes the remainder, so every outcome maps to exactly the same number of 32-bit values. A plain remainder is biased: with one byte (256 values) and n = 100, the outcomes 0–55 each have 3 byte values while 56–99 have only 2, making the first group 1.5 times as likely.
  3. Shuffling: the Fisher–Yates shuffle in Durstenfeld’s form, which Knuth gives as Algorithm P in The Art of Computer Programming, Vol. 2, §3.4.2. From the last position down, each position swaps with a random position at or before it, so each of the n! orders has exactly the same probability. A draw of k winners stops after k swaps.
  4. Numbers without repeats use Robert Floyd’s sampling algorithm, which picks k distinct values uniformly from a huge range (up to two billion integers here) in k steps; the result is then shuffled so the order is random too.
How many 32-bit samples rejection sampling throws away
Possible outcomes nAccept belowValues rejected (of 4,294,967,296)Share rejected
104,294,967,2906< 0.0001%
454,294,967,26531< 0.0001%
1004,294,967,20096< 0.0001%
1,000,0004,294,000,000967,2960.023%
2,000,000,0014,000,000,002294,967,2946.868%

The cost is negligible. Even for the full range (−1 billion to 1 billion, 2,000,000,001 integers) only 6.87% of samples are discarded and redrawn.

Why “swap with anything” shuffles are unfair

A common mistake swaps every position with any position in the whole array. With three people that gives 3 × 3 × 3 = 27 equally likely paths but only 6 orders, and 27 is not divisible by 6, so some orders must come up more often. The counts below come from the tool’s code enumerating every path for A, B and C.

OrderFaulty shuffleFisher–Yates
ABC4/27 (14.8%)1/6 (16.7%)
ACB5/27 (18.5%)1/6 (16.7%)
BAC5/27 (18.5%)1/6 (16.7%)
BCA5/27 (18.5%)1/6 (16.7%)
CAB4/27 (14.8%)1/6 (16.7%)
CBA4/27 (14.8%)1/6 (16.7%)

Sorting with a random comparator (sort(() => Math.random() − 0.5)) has a similar problem: sorting algorithms assume consistent comparisons, so the result depends on the browser’s sort implementation and the orders are not equally likely. The tool uses neither approach.

Prize draws in rounds: each person’s chances

With “Remove drawn names from the pool” ticked, each round draws from the people left and winners sit out later rounds. Take 100 entrants with 1 first prize, 3 second prizes and 10 third prizes, drawn in that order. For any one person:

PrizeWinnersChance of winning it
First11%
Second33%
Third1010%
  • Each chance equals winners ÷ entrants whatever the order of rounds: drawing third prizes first and the first prize last still gives 1% for the first prize. Starting with small prizes disadvantages nobody.
  • The chance of winning something is 14% (1 + 3 + 10 prizes ÷ 100 people).
  • Without “Remove drawn names from the pool”, winners stay in the list: one person’s chance of winning at least once drops to 13.57%, and the chance that somebody wins two or more prizes over the three rounds is 36.79%. If the rule is one prize per person, keep the box ticked.
  • The pattern holds at larger sizes: 200 people and 5, 10, 20 prizes give 2.5%, 5%, 10% per round with removal, and a 85.06% chance of a repeat winner without it.
  • A name listed twice is two tickets: in a 50-line list with one winner that person has 4% and everyone else 2%. “Remove duplicate names” keeps only the first of lines that are identical after trimming spaces, giving 49 people at 2.04% each. Tell namesakes apart with something like “Sam Lee (Sales)”.

How group sizes are worked out

The tool shuffles the whole list and cuts it into consecutive groups. When the numbers do not divide evenly, group sizes differ by at most one, with the larger groups first. These rows come straight from the tool’s split function:

PeopleSettingGroupsSizes
30Number of groups: 442 of 8, 2 of 7
30Number of groups: 555 of 6
30Number of groups: 666 of 5
30People per group: 486 of 4, 2 of 3
30People per group: 655 of 6
45Number of groups: 441 of 12, 3 of 11
45Number of groups: 555 of 9
45Number of groups: 663 of 8, 3 of 7
45People per group: 4129 of 4, 3 of 3
45People per group: 685 of 6, 3 of 5
  • With “People per group” the number is a maximum: 30 people in groups of 4 become 8 groups (6 of 4 and 2 of 3), not 7 groups of 4 plus a pair left over.
  • After the shuffle every arrangement is equally likely: a person’s chance of being in a group is proportional to its size, and where they appear in your list makes no difference.
  • There are no constraints such as mixing by gender or keeping two people apart. If you need that, split the list into parts, group each part, and join the groups by number; each part is still random.
  • The CSV has one row per person (group number, position in group, name) and opens in any spreadsheet. Names starting with =, +, - or @ get a leading apostrophe so spreadsheets do not run them as formulas.

Random numbers: how often repeats happen

With “Allow repeats” ticked, every number is drawn independently and repeats are more common than most people expect (the birthday problem):

RangeNumbers drawnChance of at least one repeat
1–10569.8%
1–1001037.2%
1–3652350.7%
  • For seat numbers, question numbers or ticket draws that must not repeat, leave the box unticked (the default). Without repeats, how many cannot exceed the integers in the range.
  • Min and max are both included and may be negative; the range is −1,000,000,000 to 1,000,000,000 with up to 10,000 numbers at a time.
  • Sorting only changes the display order, not which numbers were drawn. Keep “As drawn” when the order matters, for example when the first number drawn goes first.

Running a live prize draw

  1. Announce the rules before drawing: how many winners per prize, the order of prizes, whether winners stay in for later prizes, and what happens if a winner is absent (for example one extra draw from the people left).
  2. Show the list on screen and check the name count against the number of entrants; the tool reports how many duplicates were removed and blank lines skipped.
  3. Give each round a name such as “First prize”; the history shows the name, winners and time. Use “Copy all rounds” or take a screenshot straight away: the page stores nothing and the history is gone after a reload.
  4. Do not redraw because you dislike a result; that breaks the equal chances. If a replacement is needed, run a separate one-winner round and note why.
  5. For a new event, “Clear rounds and restore everyone” puts everyone back in the pool.
  6. The tool makes the algorithm fair, but it cannot prove afterwards that nobody drew several times and picked a favourite. When people need to trust the result, draw live with the screen visible to everyone.

Sources

Frequently asked questions

Is the draw fair?

Yes. It uses the browser’s secure random number generator and rejection sampling to avoid modulo bias, so each name in the pool has a chance of winners ÷ names left in every round.

Can someone win twice across rounds?

Not with “Remove drawn names from the pool” ticked (the default). Untick it to keep winners in the pool for later rounds.

What if the list does not divide evenly?

Group sizes differ by at most one: 30 people in 4 groups gives 8, 8, 7 and 7. With People per group, no group is larger than the number you enter.

Is my list uploaded or saved?

No. It stays on the page and is neither uploaded nor stored. The draw history disappears on reload, so copy it or take a screenshot to keep a record.