@contextmanager
def random_seed(seed):
    state = random.getstate()

    random.seed(seed)

    try:
        yield
    finally:
        random.setstate(state)
Temporarily change the seed of the random number generator.
dataset/ETHPy150Open Yelp/mrjob/tests/sandbox.py/random_seed