Everyday Tools

How to Pick a Random Winner Fairly for Giveaways and Draws

Where browser randomness comes from, how to clean and weight an entry list, how to document a draw so nobody can dispute it, and the legal basics every promotion needs.

How to Pick a Random Winner Fairly for Giveaways and Draws
Photo by Quyn Phạm on Pexels

Key takeaways

  • Browser tools that use crypto.getRandomValues draw from the operating system's entropy source, which is the standard you can defend if a result is questioned.
  • Clean the entry list before the draw: trim, normalise case, remove duplicates and disqualified entries, then freeze it.
  • Weight entries by listing a name once per entry, or by giving each person a numbered range and drawing one number.
  • Record the frozen list, the time, the method and the result, ideally with a screen recording, before announcing the winner.
  • Free entry, clear terms and a stated selection method keep most giveaways on the right side of promotion rules; check local rules.

To pick a random winner fairly, you need three things: a clean list in which every eligible person appears exactly as many times as their entries allow, a selection method that is genuinely random rather than a person pointing at a name, and a record of both that you can show anyone who asks. The randomness part is the easiest, because every modern browser has a cryptographic random source built in. The list and the record are where most disputed giveaways go wrong.

What "random" means, and where browsers get it

Computers are deterministic, so they cannot produce randomness out of nothing. They have two ways round this. A pseudo-random number generator (PRNG) takes a starting value, the seed, and runs it through a formula that produces a long stream of numbers which look random but are entirely determined by the seed. The alternative is to collect unpredictability from the physical world, such as the timing of keystrokes, disk activity and network packets, or from a hardware noise source in the processor, and use that as the raw material. Operating systems do exactly this and expose the result to programs.

In the browser, JavaScript offers both. Math.random() is a PRNG. In current engines it is a fast, high-quality one, and for a game or an animation it is fine. But it was never designed to be unpredictable to a determined observer, its seeding is an implementation detail, and the specification does not promise anything about its quality. crypto.getRandomValues(), by contrast, is required to be cryptographically strong and draws on the operating system's entropy source. It is the function used to generate encryption keys, so a winner picked with it is drawn from the same quality of randomness that protects your online banking.

Does the difference matter for a draw with 300 entrants? In practice, both would produce a fair result. The reason to prefer the cryptographic source is not that Math.random() would cheat, but that if someone challenges the result you want to be able to say the method was unpredictable by design. The random choice picker uses the cryptographic source for exactly that reason.

The modulo trap

There is one subtle way to make even a perfect random source unfair. Suppose you ask for one random byte (a value from 0 to 255) and take the remainder after dividing by 10 to pick a digit. Values 0 to 5 can each be produced 26 ways, but 6 to 9 only 25 ways, so the low digits are about 4 per cent more likely. Properly written tools avoid this by discarding values outside the largest exact multiple of the range and trying again, a technique called rejection sampling. It is worth knowing about because home-made spreadsheet formulas and quick scripts often get it wrong.

Preparing the entry list

Fairness is decided before the draw, in the list. Whatever your entry mechanism (comments, email sign-ups, a form, a hashtag), export the entries to plain text with one entry per line and then work through these steps in order.

  1. Trim and normalise. Strip leading and trailing spaces and make the case consistent, so Anna_K, anna_k and Anna_K are recognised as the same person.
  2. Decide the entry rule and apply it. One entry per person is simplest. If someone commented six times, five of those lines go, unless your terms said multiple comments count. A duplicate line remover does this in one pass.
  3. Remove the ineligible. Your own staff, accounts created after the closing time, entries that did not meet the stated condition, and anyone from a region the prize cannot be sent to.
  4. Number the list. A numbered list makes it possible to draw a number rather than a name, which is useful for weighting and for showing the draw on screen without revealing every entrant's handle.
  5. Freeze it. Save the final list with a timestamp. Nothing is added or removed after this point. If you want to be able to prove the list was not altered later, compute its SHA-256 hash with a hash generator and post the hash before the draw; anyone can later check that the list you publish matches.

Do not clean the list by eye while scrolling through it. You will miss a duplicate, or remove the wrong one, and if a loser notices they have a legitimate grievance. Use a tool that reports how many lines it removed, and write that number down.

A bowl of raffle tickets ready for a prize draw
Photo by Erik Mclean on Pexels

Weighting entries

Many promotions give extra chances for extra actions: one entry for following, two more for sharing, five for a referral. Weighting is fair as long as the rules were stated up front and the maths matches them. There are two clean ways to do it.

Repeat the name. List each person once for every entry they hold, then draw one line. Someone with five entries appears five times and has five times the chance of someone with one. This is simple and transparent, and the frozen list shows the weighting plainly.

Draw a number against ranges. Give each person a block of numbers equal to their entries and draw a single number across the whole range with the random number generator. This keeps the list short and lets you show the draw without displaying names.

EntrantEntriesNumber rangeChance of winning
Anna31 to 33 ÷ 10 = 30%
Ben24 to 52 ÷ 10 = 20%
Cara161 ÷ 10 = 10%
Dev47 to 104 ÷ 10 = 40%
Total101 to 10100%

With the table above, draw one whole number from 1 to 10 inclusive. The tool returns 8. That falls in Dev's range of 7 to 10, so Dev wins. If a second prize is on offer, remove Dev's block, renumber the remaining six entries 1 to 6, and draw again from 1 to 6. Never draw again from the original range and skip the previous winner, because that changes the odds for the people whose numbers sit next to the removed block.

Check that the total of the ranges equals the total number of entries, and that the upper bound in the tool is inclusive. A draw from "1 to 10" that can only ever return 1 to 9 quietly excludes the last entrant, and off-by-one errors of this kind are the most common bug in home-made draws.

Documenting the draw

A draw that was fair but cannot be shown to have been fair is only half finished. The record protects you, reassures entrants and answers the platform or regulator if a complaint arrives months later. Keep it short and keep all of it together.

ItemWhat to keep
TermsThe exact wording entrants saw, with the closing date and time and the time zone
Frozen listThe final entry list after cleaning, the count of entries, the count removed and why
MethodWhich tool was used, which option (one winner, weighted ranges, number from 1 to N)
EvidenceA screen recording or at least a screenshot of the draw showing the list size and the result
WitnessThe name of a second person who watched the draw, if you have one
TimingDate and time the draw ran, and when the winner was notified
OutcomeHow the winner was contacted, when they replied, and what happened if they did not

A screen recording is worth more than a screenshot because it shows the list was loaded and the button pressed once. Start the recording before pasting the list in, and say the entry count out loud or type it on screen. Announce the winner on the same channel as the promotion, using the same name format entrants used, and state the total number of entries. Publishing "1 winner from 1,284 valid entries, drawn at 10:00 on 3 May" does more for trust than any amount of reassurance.

Decide in advance what happens if the winner does not reply. A fixed window, such as seven days, followed by a redraw from the same frozen list minus the non-responder, is the standard approach, and it should be in the terms.

A wrapped gift box on a table
Photo by Vidal Balielo Jr. on Pexels

Rules differ by country and sometimes by region, and this section is general guidance rather than legal advice, so check the rules that apply where you and your entrants are. That said, most jurisdictions share a few principles.

  • Free entry keeps a draw out of lottery law. A prize awarded by chance in return for payment is usually a lottery, which is licensed or restricted. Making entry free, or providing a free route alongside a paid one, is how most giveaways stay on the right side of the line. "Buy a product to enter" may change the category.
  • Publish terms. Who can enter, including age and location limits; the opening and closing times; what the prize is and whether it can be exchanged; how the winner is chosen, including any weighting; how and when the winner is notified; and what happens if they do not respond.
  • Follow the platform's rules. Social networks have their own promotion policies, typically requiring a release stating the platform is not a sponsor and prohibiting entry mechanics such as tagging people in photos they are not in.
  • Handle data properly. Entrant details are personal data. Collect only what the draw needs, state what it will be used for, and delete it when the promotion is closed and any complaint period has passed.
  • Be honest about the odds and the prize. Advertising rules in many countries require that the prize is as described and that the chance of winning is not misrepresented.

For anything beyond a small social giveaway, especially where the prize is valuable, entry is tied to a purchase, or entrants are in several countries, get advice before you launch.

Dice, number ranges and letters

Not every selection is a prize draw. The same tools cover the smaller decisions, and a little probability helps you set them up correctly.

A single die is a uniform draw from 1 to 6; each face has a 1 in 6 chance, or 16.7 per cent. Two dice added together are not uniform. There are 36 equally likely combinations, and only one of them (1 and 1) makes 2, while six of them make 7. So 7 comes up 6 ÷ 36 = 16.7 per cent of the time and 2 or 12 only 2.8 per cent each. If you want every outcome equally likely, draw one number from 2 to 12 instead of rolling two dice.

For number ranges, write down whether the bounds are inclusive before you start. "Pick a number between 1 and 100" nearly always means 1 and 100 are allowed, giving 100 possibilities and a 1 per cent chance each. Shuffling a list into a random order (to decide who presents first, or the order of a draw) is a different operation from picking one item, and a good tool offers both.

Random letters are useful for breaking ties, assigning groups, choosing a starting player by alphabetical position, and games where everyone has to name something beginning with the letter. A random letter draw gives each of the 26 letters a 1 in 26 chance, or about 3.8 per cent; if you exclude the awkward ones such as Q, X and Z, say so before the draw rather than after.

Where to go next

Paste a cleaned list into the random choice picker to draw one or more winners, use the random number generator for weighted ranges, dice and numbered tickets, and the random letter generator for games and group assignments. All three run in your browser using the cryptographic random source, and the list you paste never leaves your machine.

Frequently asked questions

Is Math.random fair enough for a giveaway?

For a small draw it would almost certainly produce a fair result, since modern engines use good pseudo-random generators. The problem is that it is not designed to be unpredictable and the specification makes no promises about its quality, so you cannot defend it if a result is challenged. Tools built on crypto.getRandomValues use the operating system's entropy source, which is the standard for encryption keys and the one worth citing in your draw record.

How do I pick a random winner from comments?

Export or copy the comments into a plain list with one username per line. Trim spaces and normalise the case, remove duplicate names unless your terms allowed multiple entries, delete anyone ineligible, and save the final list with a timestamp and the count. Then paste it into a random picker, record your screen while you press the button, and announce the winner on the same channel with the total number of valid entries.

Can I give some people more chances to win?

Yes, provided the terms said so before entries opened. Either list each person once per entry and draw a line, or give each person a block of numbers equal to their entries and draw one number across the whole range. If Anna has three entries and Ben has one, Anna gets numbers 1 to 3 and Ben gets 4; a draw from 1 to 4 gives Anna a 75 per cent chance, which matches the stated weighting.

Do I need to post proof of the draw?

There is rarely a legal requirement to publish the evidence, but you should keep it, and sharing a summary builds trust. At minimum keep the frozen entry list, the count, the method and a screen recording or screenshot of the result. When you announce the winner, state the number of valid entries and the time of the draw. If a platform or advertising regulator receives a complaint, that record is what resolves it.

Is a giveaway the same as a lottery?

Usually not, and the difference is normally payment. A lottery awards a prize by chance in exchange for a stake, and in most countries it is licensed or restricted to charities and the state. A giveaway with free entry, or with a genuinely free route alongside any paid one, is generally treated as a prize promotion instead. The exact tests vary by country and sometimes by region, so check local rules, particularly if entry is linked to a purchase.

What is the chance of rolling a 7 with two dice?

One in six, or about 16.7 per cent. Two six-sided dice produce 36 equally likely combinations, and six of them add up to 7: 1 and 6, 2 and 5, 3 and 4, 4 and 3, 5 and 2, 6 and 1. By comparison, only one combination makes 2 and one makes 12, so each of those has a 1 in 36 chance. If you need every total from 2 to 12 to be equally likely, draw one number from that range instead of rolling.

Try the tools from this guide

Keep reading

Related guides

All guides