'Check returning an array according to a given distribution.'

def _check_array_dist(self, funcname, scalar_args):

    cfunc = self._compile_array_dist(funcname, (len(scalar_args) + 1))
    r = self._follow_numpy(get_np_state_ptr())
    pyfunc = getattr(r, funcname)
    for size in (8, (2, 3)):
        args = (scalar_args + (size,))
        expected = pyfunc(*args)
        got = cfunc(*args)
        if ((expected.dtype == np.dtype('int32')) and (got.dtype == np.dtype('int64'))):
            expected = expected.astype(got.dtype)
        self.assertPreciseEqual(expected, got, prec='double', ulps=5)
