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