Developer Lists

Shuffle lines

What to do

Transformed in your browser · nothing is uploaded

Local · deterministic here, seeded shuffle elsewhere
Advertisement
320 × 100

Reorders a list of lines: sorted A–Z or Z–A, reversed, or with the repeats taken out. Sorting ignores case and accents, and every option drops blank lines. For a genuinely random shuffle with a seed you can quote afterwards, the random order generator is the tool.

How to use the shuffle lines

1 Paste one item per line. A copied spreadsheet column already arrives that way.
2 Choose sort, reverse or remove duplicates.
3 Blank lines disappear from the result; that is deliberate.
4 Copy the reordered list, or save it as a text file.

The sort compares base letters rather than character codes, and that is the difference people notice. A code-point sort: the default in most programming languages: puts every capital ahead of every lowercase letter, so Zebra lands before apple. Here they compare as the same letters and apple comes first. Accents are folded the same way, so Émile and Emile compare as equal; the sort is stable, so equal items keep the order they arrived in. Numbers are still text: 100 sorts before 9, and the word sorter is where the numeric option lives.

There is deliberately no random shuffle here. The tempting one-liner: sorting with a comparator that returns a random number. Is not a shuffle: a sort only asks about a fraction of the possible pairs and assumes the answers are consistent, so the orders it produces are not equally likely and which ones come up depends on the sorting algorithm rather than on chance. A correct shuffle walks the list from the end, swapping each item with a randomly chosen earlier one. That is what the random order generator does, and it takes a seed, so a draw can be re-run and shown to have produced the same order.

Questions

On the random order generator, which uses a real shuffle and takes a seed, so a draw can be reproduced afterwards.

MDN, working with strings
Advertisement
300 × 250
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding