MCPcopy Index your code
hub / github.com/dask/dask / test_random_state_data

Function test_random_state_data

dask/tests/test_utils.py:248–269  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

246
247
248def test_random_state_data():
249 np = pytest.importorskip("numpy")
250 seed = 37
251 state = np.random.RandomState(seed)
252 n = 10000
253
254 # Use an integer
255 states = random_state_data(n, seed)
256 assert len(states) == n
257
258 # Use RandomState object
259 states2 = random_state_data(n, state)
260 for s1, s2 in zip(states, states2):
261 assert s1.shape == (624,)
262 assert (s1 == s2).all()
263
264 # Consistent ordering
265 states = random_state_data(10, 1234)
266 states2 = random_state_data(20, 1234)[:10]
267
268 for s1, s2 in zip(states, states2):
269 assert (s1 == s2).all()
270
271
272def test_memory_repr():

Callers

nothing calls this directly

Calls 3

random_state_dataFunction · 0.90
RandomStateMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…