randomly permutes the lines of a file, with optional constrains