def const_rand ( size , seed = 23980 ) : old_seed = np . random . seed ( ) np . random . seed ( seed ) out = np . random . rand ( size ) np . random . seed ( old_seed ) return out
python how to set numpy random seed
Generate a random array with a fixed seed .
def const_rand(size, seed=23980):
    """ Generate a random array with a fixed seed.
    """
    old_seed = np.random.seed()
    np.random.seed(seed)
    out = np.random.rand(size)
    np.random.seed(old_seed)
    return out