random-line 290 Bytes
Newer Older
1
#!/usr/bin/env python3
2
# based on Fisher-Yates shuffle
3
# SPDX-License-Identifier: WTFPL
4

5
6
7
import fileinput
import random
import sys
8

9
10
choice = None
for n, line in enumerate(fileinput.input()):
11
12
	if not random.randrange(n + 1):
		choice = line
13
14
15

if choice is not None:
	sys.stdout.write(choice)