Posted By

gba on 07/02/09


Tagged

list textmate python random


Versions (?)

randomize a list


 / Published in: Other
 

  1. if out_of_order_events:
  2. randomized_logfile_lines = []
  3. while len(logfile_lines):
  4. randomized_logfile_lines.append(logfile_lines.pop(random.randrange(0,len(logfile_lines))))
  5. logfile_lines = randomized_logfile_lines

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: gba on July 2, 2009

this is probably almost exactly the same as: random.shuffle(logfile_lines)

You need to login to post a comment.