Exemplo n.º 1
0
def test_shuffle_slice(size, chunks):
    x = da.random.randint(0, 1000, size=size, chunks=chunks)
    index = np.arange(len(x))
    np.random.shuffle(index)

    a = x[index]
    b = shuffle_slice(x, index)
    assert_eq(a, b)
Exemplo n.º 2
0
    def permutation(self, x):
        from dask.array.slicing import shuffle_slice

        if isinstance(x, numbers.Number):
            x = arange(x, chunks="auto")

        index = np.arange(len(x))
        self._numpy_state.shuffle(index)
        return shuffle_slice(x, index)