Although Marcin is a similar third option, the Luc implementation always returns the first line when parsing the entire file.
It should be something like:
chosen_line = ""
treshold = 90
max = 100
while chosen_line == "":
current_line = readline()
if (rand(0, max) > treshold):
chosen_line = current_line
print chosen_line
You can also return current_line in case the line is not selected and you read the whole file.
source
share