code: def _make_rand_csd(info, csd):
      rng = np.random.RandomState(0)
      data = _rand_csd(rng, info)
      # now we need to have the same null space as the data csd
      s, u = np.linalg.eigh(csd.get_data(csd.frequencies[0]))
      mask = np.abs(s) >= s[-1] * 1e-7
      rank = mask.sum()
      assert rank == len(data) == len(info["ch_names"])
      noise_csd = CrossSpectralDensity(
          _sym_mat_to_vector(data), info["ch_names"], 0.0, csd.n_fft
      )
      return noise_csd, rank
  
imports: import copy
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal, assert_array_less
  import mne
  from mne import pick_types
  from mne._fiff.constants import FIFF
  from mne._fiff.pick import pick_info
  from mne.beamformer import Beamformer, apply_dics, apply_dics_csd, apply_dics_epochs, apply_dics_tfr_epochs, make_dics, read_beamformer
  from mne.beamformer._compute_beamformer import _prepare_beamformer_input
  from mne.beamformer._dics import _prepare_noise_csd
  from mne.beamformer.tests.test_lcmv import _assert_weight_norm
  from mne.datasets import testing
  from mne.io import read_info
  from mne.proj import compute_proj_evoked, make_projector
  from mne.surface import _compute_nearest
  from mne.time_frequency import CrossSpectralDensity, EpochsTFR, csd_morlet, csd_tfr
  from mne.time_frequency.csd import _sym_mat_to_vector
  from mne.transforms import apply_trans, invert_transform
  from mne.utils import catch_logging, object_diff
label_desc: Use image node_id 4 for calling a global function with example usage: _make_rand_csd(info, csd) and returns: noise_csd,  rank