code: def validate_rand(err_str, rand_type, low, high, q):
      """Validate parameters to random number generators."""
      err_msg = "{}: {}(low={}, high={}, q={}) is invalid."
      err_msg = err_msg.format(err_str, rand_type, low, high, q)
      low_q = Decimal(str(low)) % Decimal(str(q)) == 0
      high_q = Decimal(str(high)) % Decimal(str(q)) == 0
      assert type(q) == type(low) == type(high), err_msg
      assert rand_type in rand_types, err_msg
      assert q > 0 and low <= high, err_msg
      assert low > 0 or rand_type in ["uniform", "normal"], err_msg
      assert (
          low_q and high_q or rand_type == "power2_or_log_uniform"
      ), err_msg
      if rand_type in ["power2_uniform", "power2_or_log_uniform"]:
          assert all(
              np.log2(v).is_integer() for v in [low, high, q]
          ), err_msg
  
file_path: pycls/pycls/sweep/random.py
imports: from decimal import Decimal
  import matplotlib.pyplot
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: validate_rand(err_str, rand_type, low, high, q) without return types