def random_bounded_uint64_fill(bitgen, low, rng, size, dtype):
    """
    Returns a new array of given size with 64 bit integers
    bounded by given interval.
    """
    out = np.empty(size, dtype=dtype)
    if rng == 0:
        for i in np.ndindex(size):
            out[i] = low
    elif rng <= 0xFFFFFFFF:
        if (rng == 0xFFFFFFFF):
            for i in np.ndindex(size):
                out[i] = low + next_uint32(bitgen)
        else:
            for i in np.ndindex(size):
                out[i] = low + buffered_bounded_lemire_uint32(bitgen, rng)

    elif (rng == 0xFFFFFFFFFFFFFFFF):
        for i in np.ndindex(size):
            out[i] = low + next_uint64(bitgen)
    else:
        for i in np.ndindex(size):
            out[i] = low + bounded_lemire_uint64(bitgen, rng)

    return out

    Returns a new array of given size with 64 bit integers
    bounded by given interval.
    
numba/np/random/new_random_methods.py