pipr.tools
Pipes
Clean Email Strip formatting from pasted email for clean plain text Clean AI Output Clean plain text from ChatGPT or AI output Decode & Format JWT Decode a JWT and pretty-print header and payload Word Frequency Count word frequency in text

shuffle-lines Randomize line order

Aa Text
Input0 chars
Output0 chars

Examples

Randomize a list for standup speaking order

Usage
"Alice
Bob
Charlie
Dave
Eve
Frank" | shuffle-lines

Randomize quiz question order for a test

Usage
"What is 2+2?
Name the capital of France.
Spell 'necessary'.
..." | shuffle-lines

Shuffle team names for random matchup order on game night

Usage
"Team Alpha
Team Bravo
Team Charlie
Team Delta" | shuffle-lines
View source
(input)=>{
                const lines = input.split("\n");
                for(let i = lines.length - 1; i > 0; i--){
                    const j = Math.floor(Math.random() * (i + 1));
                    [lines[i], lines[j]] = [
                        lines[j],
                        lines[i]
                    ];
                }
                return lines.join("\n");
            }