code: def test_random_diag():
      d = np.arange(10) + 1
      np.random.seed(42)
      pots = [
          quadpotential.quad_potential(d, True),
          quadpotential.quad_potential(1.0 / d, False),
          quadpotential.quad_potential(np.diag(d), True),
          quadpotential.quad_potential(np.diag(1.0 / d), False),
      ]
      if quadpotential.chol_available:
          d_ = scipy.sparse.csc_matrix(np.diag(d))
          pot = quadpotential.quad_potential(d_, True)
          pots.append(pot)
      for pot in pots:
          vals = np.array([pot.random() for _ in range(1000)])
          npt.assert_allclose(vals.std(0), np.sqrt(1.0 / d), atol=0.1)
  
imports: import warnings
  import numpy
  import numpy.testing
  import pytest
  import scipy.sparse
  import pymc
  from pymc.pytensorf import floatX
  from pymc.step_methods.hmc import quadpotential
label_desc: Use image node_id 6 for calling a global function with example usage: test_random_diag() without return types