def in_random_order(data):
 indexes = [i for (i, _) in enumerate(data)]
 random.shuffle(indexes)
 for i in indexes:
  (yield data[i])

def in_random_order ( data ) : indexes = [ i for ( i , _ ) in enumerate ( data ) ] random . shuffle ( indexes ) for i in indexes : ( yield data [ i ] )
generator that returns the elements of data in random order .