def _sample_without_replacement(n, r, out):
    """
    Main body of `sample_without_replacement`. To be complied as a ufunc
    by guvectorize of Numba.

    """
    k = r.shape[0]

    # Logic taken from random.sample in the standard library
    pool = np.arange(n)
    for j in range(k):
        idx = int(np.floor(r[j] * (n-j)))  # np.floor returns a float
        out[j] = pool[idx]
        pool[idx] = pool[n-j-1]
def _sample_without_replacement ( n , r , out ) : k = r . shape [ 0 ] pool = np . arange ( n ) for j in range ( k ) : idx = int ( np . floor ( r [ j ] * ( n - j ) ) ) out [ j ] = pool [ idx ] pool [ idx ] = pool [ n - j - 1 ]
Main body of `sample_without_replacement`. To be complied as a ufunc
    by guvectorize of Numba.