MCPcopy Index your code
hub / github.com/numpy/numpy / random_slice

Function random_slice

numpy/_core/tests/test_mem_overlap.py:239–245  ·  view source on GitHub ↗
(n, step)

Source from the content-addressed store, hash-verified

237 raise ValueError
238
239 def random_slice(n, step):
240 start = rng.randint(0, n + 1, dtype=np.intp)
241 stop = rng.randint(start, n + 1, dtype=np.intp)
242 if rng.randint(0, 2, dtype=np.intp) == 0:
243 stop, start = start, stop
244 step *= -1
245 return slice(start, stop, step)
246
247 def random_slice_fixed_size(n, step, size):
248 start = rng.randint(0, n + 1 - size * step)

Callers 2

iter_random_view_pairsFunction · 0.85

Calls 1

sliceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…