code: def plot_rand_cdf(rand_type, low, high, q, n=10000):
      """Visualizes CDF of rand_fun, resulting CDF should be linear (or log-linear)."""
      validate_rand("plot_rand_cdf", rand_type, low, high, q)
      samples = [rand_types[rand_type](low, high, q) for _ in range(n)]
      unique = list(np.unique(samples))
      assert (
          min(unique) >= low and max(unique) <= high
      ), "Sampled value out of range."
      cdf = np.cumsum(
          np.histogram(samples, unique + [np.inf])[0]
      ) / len(samples)
      plot_fun = (
          plt.plot
          if rand_type in ["uniform", "normal"]
          else plt.semilogx
      )
      plot_fun(
          unique,
          cdf,
          "o-",
          [low, low],
          [0, 1],
          "-k",
          [high, high],
          [0, 1],
          "-k",
      )
      plot_fun(
          [low, high], [cdf[0], cdf[-1]]
      ) if "normal" not in rand_type else ()
      plt.title(
          "{}(low={}, high={}, q={})".format(rand_type, low, high, q)
      )
      plt.show()
  
file_path: pycls/pycls/sweep/random.py
imports: from decimal import Decimal
  import matplotlib.pyplot
  import numpy
label_desc: Use image node_id 9 for calling a global function with example usage: plot_rand_cdf(rand_type, low, high, q, n) without return types