MCPcopy Create free account
hub / github.com/dask/dask / permutation

Method permutation

dask/array/random.py:305–321  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

303
304 @derived_from(np.random.Generator, skipblocks=1)
305 def permutation(self, x):
306 from dask.array.slicing import shuffle_slice
307
308 if self._backend_name == "cupy":
309 raise NotImplementedError(
310 "`Generator.permutation` not supported for cupy-backed "
311 "Generator objects. Use the 'numpy' array backend to "
312 "call `dask.array.random.default_rng`, or pass in "
313 " `numpy.random.PCG64()`."
314 )
315
316 if isinstance(x, numbers.Number):
317 x = arange(x, chunks="auto")
318
319 index = self._backend.arange(len(x))
320 _shuffle(self._bit_generator, index)
321 return shuffle_slice(x, index)
322
323 @derived_from(np.random.Generator, skipblocks=1)
324 def poisson(self, lam=1.0, size=None, chunks="auto", **kwargs):

Callers 2

test_nlargest_nsmallestFunction · 0.45
test_groupby_concat_cudfFunction · 0.45

Calls 4

arangeFunction · 0.90
shuffle_sliceFunction · 0.90
_shuffleFunction · 0.70
arangeMethod · 0.45

Tested by 2

test_nlargest_nsmallestFunction · 0.36
test_groupby_concat_cudfFunction · 0.36