Shuffle Lines API

Category: text

Randomly shuffle/reorder lines of text. Runs entirely in the browser.

Endpoint

N/A Browser API (JavaScript)
No Server API

Response

Content-Type: N/A

This tool shuffles text lines in the browser using JavaScript. No server-side API is available.

// Browser-only: lines are shuffled using Fisher-Yates

cURL Example

# No cURL equivalent — this tool runs in the browser

Code Samples

// Shuffle lines (Fisher-Yates)
const lines = text.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]];
}
const shuffled = lines.join('\n');
import random
lines = text.split('\n')
random.shuffle(lines)
shuffled = '\n'.join(lines)
List<String> lines = new ArrayList<>(Arrays.asList(text.split("\n")));
Collections.shuffle(lines);
String shuffled = String.join("\n", lines);