Skip to main content

How to Pick a Random Line From a List Fairly (Random Line Picker Guide)

Pick one or several random lines from any list with equal odds for every entry. Draw giveaway winners, sample data, and learn pick with vs without replacement.

Published By Li Lei
#random line picker #raffle #random sampling #giveaway #fair selection

How to Pick a Random Line From a List Fairly

Most "pick a random line" needs start the same way: you have a list, you want one or a few entries out of it, and you want everyone watching to believe the choice was fair. A giveaway with 240 entrants. A standup where nobody wants to speak first. A log file with 2,000 lines you can only read 50 of by hand. The hard part is never the list. It's the fairness — and the quiet doubt that the draw was nudged.

This guide walks through how to pick random lines so every entry has exactly the same chance, when to draw with repeats and when not to, and how to run a giveaway draw that holds up if someone audits it afterward.

Paste a list, pick a line, every entry equally likely

The mechanics are deliberately boring, which is the point. Paste your list with one item per line, set how many lines you want, and press the button. The Random Line Picker selects a uniformly random line, so every entry — the first one, the last one, the one buried in the middle — carries the same probability of being chosen.

"Uniformly random" is doing real work in that sentence. A common shortcut is to grab lines[Math.floor(Math.random() * lines.length)], and for one pick that's roughly fine. But Math.random is built for speed, not for fairness, and the moment you draw several lines it's easy to introduce subtle bias toward the top or bottom of the list. The picker instead shuffles the whole list with a Fisher-Yates algorithm driven by crypto.getRandomValues, the browser's cryptographically secure random source. Every possible ordering of your list is equally likely, so in a 50-line list each line has exactly a 1-in-50 chance on the first pull. No hidden weighting, no favored positions.

Two small cleanup options keep that fairness honest. "Trim spaces" makes Alice and Alice count as the same entry instead of two. "Skip blank lines" drops empty rows so a stray double-press of Enter never becomes a phantom winner. A line counter above the box shows how many usable entries remain after cleanup, so you can confirm the real pool size before you draw.

Pick with replacement versus without replacement

This is the one concept worth understanding before you draw, because picking the wrong mode quietly changes the math.

Without replacement is the default. Each line can be picked at most once, like pulling names from a hat and not putting them back. This is what you want for a fair raffle with distinct winners: ask for three winners from twenty entrants and you get three different names, never the same person twice. The catch is that the draw can only return as many distinct lines as you pasted. Ask for 10 winners from 6 entries and you get 6 — the picker warns you rather than inventing duplicates.

With replacement puts each line back after it's drawn, so the same entry can come up more than once. From a list of [A, B], picking 3 with replacement might give you [A, A, B]; without replacement it caps at 2. Replacement is the right call when each draw is meant to be independent — re-rolling a weighted choice, simulating dice, or any case where "the same thing twice in a row" is a legitimate outcome rather than a bug.

A quick rule of thumb: if the picked lines are people who shouldn't win twice, keep replacement off. If they're independent events that can repeat, turn it on.

A worked example: drawing a giveaway winner

Here's the flow I run most often. Say I'm closing a giveaway and I've collected entries — one handle per line — into a plain list:

@maple_dev
@quietcoder
@sora.builds
@nineties_kid
@latte_logic
@root_access
... (240 lines total)

I paste all 240 lines into the box, set the count to 3, and leave repeats off because no one should win two prizes. Press Pick, and three handles land highlighted. Because the draw runs without replacement, they're guaranteed distinct, and because it uses a crypto-grade shuffle, each of the 240 entrants had an honest 1-in-240 shot at the first slot.

The part that makes it auditable is what doesn't get shared. The picker can encode your list and the count into the URL, but it never writes the random result into the link — on purpose. So before the stream I paste the share URL into chat, and viewers see the exact, frozen entrant pool. Then I draw live on screen. Since the outcome was never in the link, nobody could have read the winners ahead of time, and nobody can claim I swapped the list mid-draw. I copy the three winners into chat, press Pick again if I need alternates, and I'm done.

If you'd rather not draw at all and instead reveal the whole order — first place, second place, all the way down — reorder the entire list with the List Randomizer instead. Under the hood it's the same Fisher-Yates math; picking three without replacement is just shuffling and stopping after three.

Beyond raffles: sampling and decisions

Fair line picking shows up far outside giveaways.

Random sampling. You have 2,000 survey responses or log lines and the budget to read 50 by hand for a quality check. Paste them in, set the count to 50, keep repeats off, and you get an unbiased sample with no spreadsheet formula. This matters more than it looks: a naive "take the first 50" or "every 40th row" can skew toward whatever ordering the file already has — chronological, alphabetical, by source. A crypto-random sample doesn't lean toward the start or end of the file.

Decision making. List the ten lunch spots your team argues about, press Pick, and let the draw end the debate. The same flow assigns a chore, picks a topic for a talk, or chooses who presents first. One line per option, one button, and the decision is made without anyone feeling they steered it — which is often the actual goal, not the randomness itself.

Ordering people. Five people on a standup, nobody volunteers. Set the count to 1 for a single fair starter, or set it to 5 without replacement to get the whole speaking order in one draw.

When you need numbers, not lines

If your "list" is really a numeric range — pick a winner by ticket number, roll a die, choose a random integer between 1 and 1000 — you don't need to type out every value as a line. The Random Number Generator handles ranges directly, with its own with- and without-replacement modes, so you're not pasting a thousand lines just to draw one. Reach for the line picker when the entries are real text — names, handles, options, rows — and for numbers reach for the generator.

A few things that quietly go wrong

Three mistakes account for most "this draw looks off" reports:

  • Asking for more lines than the list holds with repeats off. Without replacement, the pool is the ceiling. The fix is either to lower the count or, if duplicates are genuinely acceptable, turn replacement on.
  • Leaving blank lines or trailing spaces with cleanup disabled. An empty row can be "picked" as a blank winner, and Alice versus Alice count as two entrants. Keep trim and skip-blank on, and trust the line counter.
  • Expecting the shared URL to reproduce the winners. It encodes only the list and the count, never the result — by design, so the draw stays unpredictable. To prove who won, copy the result text and share that, not the link.

Get those three right and the rest takes care of itself: paste a clean list, pick the mode that matches whether repeats are allowed, and draw.


Made by Toolora · Updated 2026-06-13