def random_combination(iterable, r):
 pool = tuple(iterable)
 n = len(pool)
 indices = sorted(random.sample(xrange(n), r))
 return tuple((pool[i] for i in indices))

def random_combination ( iterable , r ) : pool = tuple ( iterable ) n = len ( pool ) indices = sorted ( random . sample ( xrange ( n ) , r ) ) return tuple ( ( pool [ i ] for i in indices ) )
random_combination -> tuple arguments: iterable: an iterable .