def rand_unit_complex(shape, ftype='double'):
    """Return random complex values in the [0, 1) interval.

    Parameters
    ----------
    shape : int or sequence of ints
        Output shape. For instance, if the shape is ``(m, n)``, then ``m * n``
        samples are drawn.
    ftype : str or dtype, optional
        Output float type. Choose between 'single', 'double', or 'longdouble'.
        Default is 'double', in which case the output array will be composed of
        128-bit complex floats.

    Returns
    -------
    out : ndarray of complex floats
    """
    from numpy.random import ranf
    return ranf(shape).astype(ftype) + 1.0j * ranf(shape).astype(ftype)
