Random line picker — pull random lines from any text

Paste a list, a poem, a log or a column from a spreadsheet, say how many lines you want, and the tool picks that many at random, keeping each line exactly as written.

Live demo · real result from this tool

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use the random line picker

  1. Paste your text into Text. Each line is one entry.
  2. Set Lines to pick, from 1 to 1,000.
  3. Choose the options: Allow repeats lets a line come up more than once, Keep original order lists the picks in the order they appear in your text, and Skip blank lines (on by default) leaves empty lines out of the draw.
  4. Press Pick lines and copy the result.

What it does and when to use it

Use it to sample a long list: pick 20 rows from a customer list to check by hand, choose five questions from a question bank, draw a random quote from a file of favourites, or pull test cases from a log. Because it returns plain lines, you can paste the result back into a spreadsheet or document without cleaning it up.

For a list in a new order rather than a sample, use the list shuffler. To split the lines into teams, use the random team generator. If some lines should be more likely than others, the weighted random picker accepts a weight on each line.

How it works

The text is split at every line break. With Skip blank lines on, lines with only spaces are removed; otherwise they stay in the pool as empty entries. Each remaining line keeps its position number.

Without repeats, the tool shuffles the lines with a Fisher–Yates shuffle and takes the first ones, so every set of lines is equally likely. With Allow repeats, each pick is an independent draw. Both use crypto.getRandomValues for the random numbers. Keep original order then sorts the chosen lines by their position number.

Worked examples

The whole poem, in order. The sample text has five lines. Asking for 10 lines with Keep original order ticked returns all five in their original order, from “Line one of the poem” to “Fifth and final”, plus the note “Only 5 lines are available without repeats.”

Blank lines counted. The text a, an empty line and b, with Skip blank lines off and 5 lines requested, has three entries, so you get a, an empty line and b in some order and the note “Only 3 lines are available without repeats.”

Two random lines (the default). One of the ten possible pairs from the poem, in random order.

Limits and tips

  • Very long single lines are fine; the limit is on the number of picks, not line length.
  • Lines are kept exactly, including spaces at the start, so indentation and code survive.
  • Your text is processed in your browser and never uploaded.

Frequently asked questions

How is this different from the random picker?
The random picker trims each option and shows the first pick large, which suits names and choices. The line picker returns whole lines as plain text, keeps leading spaces and punctuation, can keep the original order, and handles up to 1,000 lines per press.
What does Keep original order do?
The lines are still chosen at random, but they are shown in the order they appear in your text. Use it when you sample sentences from a document and want them to read in sequence.
Can a line be picked twice?
Only if you tick Allow repeats. Otherwise each line can be chosen once, and asking for more lines than you have returns them all with a note.
Are duplicate lines treated as one?
No. Two identical lines are two separate entries, so that text has twice the chance of being picked. Remove duplicates first with remove duplicate lines if each value should count once.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close