'Draw random correlation matrices
Parameters
eigs : 1d ndarray
Eigenvalues of correlation matrix
tol : float, optional
Tolerance for input parameter checks
diag_tol : float, optional
Tolerance for deviation of the diagonal of the resulting
matrix. Default: 1e-7
Raises
RuntimeError
Floating point error prevented generating a valid correlation
matrix.
Returns
rvs : ndarray or scalar
Random size N-dimensional matrices, dimension (size, dim, dim),
each having eigenvalues eigs.'

def rvs(self, eigs, random_state=None, tol=1e-13, diag_tol=1e-07):

    (dim, eigs) = self._process_parameters(eigs, tol=tol)
    random_state = self._get_random_state(random_state)
    m = ortho_group.rvs(dim, random_state=random_state)
    m = np.dot(np.dot(m, np.diag(eigs)), m.T)
    m = self._to_corr(m)
    if (abs((m.diagonal() - 1)).max() > diag_tol):
        raise RuntimeError('Failed    to    generate    a    valid    correlation    matrix')
    return m
