MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / get_rng

Function get_rng

tensorpack/utils/utils.py:128–141  ·  view source on GitHub ↗

Get a good RNG seeded with time, pid and the object. Args: obj: some object to use to generate random seed. Returns: np.random.RandomState: the RNG.

(obj=None)

Source from the content-addressed store, hash-verified

126
127
128def get_rng(obj=None):
129 """
130 Get a good RNG seeded with time, pid and the object.
131
132 Args:
133 obj: some object to use to generate random seed.
134 Returns:
135 np.random.RandomState: the RNG.
136 """
137 seed = (id(obj) + os.getpid() +
138 int(datetime.now().strftime("%Y%m%d%H%M%S%f"))) % 4294967295
139 if _RNG_SEED is not None:
140 seed = _RNG_SEED
141 return np.random.RandomState(seed)
142
143
144_EXECUTE_HISTORY = set()

Callers 7

__init__Method · 0.90
atari.pyFile · 0.90
__init__Method · 0.90
__init__Method · 0.90
reset_stateMethod · 0.85
reset_stateMethod · 0.85
reset_stateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected