def irandomize(iterable, seed=None):
    """
    Randomize the iterable.

    Note: this evaluates the entire iterable to a sequence in memory
    """
    if seed is None:
        from random import shuffle
    else:
        from random import Random
        shuffle = Random(seed).shuffle
    result = list(iterable)
    shuffle(result)
    return iter(result)

    Randomize the iterable.

    Note: this evaluates the entire iterable to a sequence in memory
    
recipes/Python/466177_Randomize_an_iterator/recipe-466177.py