code: def random_spd(p, eig_min, cond, random_state=0):
      """Generate a random symmetric positive definite matrix.
  
      Parameters
      ----------
      p : int
          The first dimension of the array.
  
      eig_min : float
          Minimal eigenvalue.
  
      cond : float
          Condition number, defined as the ratio of the maximum eigenvalue to the
          minimum one.
  
      random_state : int or numpy.random.RandomState instance, optional
          random number generator, or seed.
  
      Returns
      -------
      output : numpy.ndarray, shape (p, p)
          A symmetric positive definite matrix with the given minimal eigenvalue
          and condition number.
      """
      rand_gen = np.random.default_rng(random_state)
      mat = rand_gen.standard_normal((p, p))
      unitary, _ = linalg.qr(mat)
      diag = random_diagonal(
          p,
          v_min=eig_min,
          v_max=cond * eig_min,
          random_state=random_state,
      )
      return unitary.dot(diag).dot(unitary.T)
  
imports: import copy
  import warnings
  from math import cosh, exp, log, sinh, sqrt
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from pandas import DataFrame
  from scipy import linalg
  from sklearn.covariance import EmpiricalCovariance, LedoitWolf
  from nilearn._utils.extmath import is_spd
  from nilearn.connectome.connectivity_matrices import ConnectivityMeasure, _check_spd, _check_square, _form_symmetric, _geometric_mean, _map_eigenvalues, prec_to_partial, sym_matrix_to_vec, vec_to_sym_matrix
  from nilearn.tests.test_signal import generate_signals
label_desc: Use image node_id 2 for calling a global function with example usage: random_spd(p, eig_min, cond, random_state) and returns: unitary