diff --git a/funcy/seqs.py b/funcy/seqs.py index 9a96252..9d36bda 100644 --- a/funcy/seqs.py +++ b/funcy/seqs.py @@ -11,7 +11,7 @@ __all__ = [ - 'count', 'cycle', 'repeat', 'repeatedly', 'iterate', + 'count', 'cycle', 'repeat', 'repeatedly', 'iterate', 'shuffle', 'take', 'drop', 'first', 'second', 'nth', 'last', 'rest', 'butlast', 'ilen', 'map', 'filter', 'lmap', 'lfilter', 'remove', 'lremove', 'keep', 'lkeep', 'without', 'lwithout', 'concat', 'lconcat', 'chain', 'cat', 'lcat', 'flatten', 'lflatten', 'mapcat', 'lmapcat', @@ -34,6 +34,12 @@ def _lfilter(f, seq): # Re-export from itertools import count, cycle, repeat +import random + +def shuffle(seq): + new_seq = seq.copy() + random.shuffle(new_seq) + return new_seq def repeatedly(f, n=EMPTY): """Takes a function of no args, presumably with side effects,