'Draw random samples from U(N).
Parameters
dim : integer
Dimension of space (N).
size : integer, optional
Number of samples to draw (default 1).
Returns
rvs : ndarray or scalar
Random size N-dimensional matrices, dimension (size, dim, dim)'

def rvs(self, dim, size=1, random_state=None):

    size = int(size)
    if (size > 1):
        return np.array([self.rvs(dim, size=1, random_state=random_state) for i in range(size)])
    dim = self._process_parameters(dim)
    random_state = self._get_random_state(random_state)
    z = ((1 / math.sqrt(2)) * (random_state.normal(size=(dim, dim)) + (1j * random_state.normal(size=(dim, dim)))))
    (q, r) = scipy.linalg.qr(z)
    d = r.diagonal()
    q *= (d / abs(d))
    return q
