code: def _generate_random_hparam_values(
      hparam_def: Dict[str, Any]
  ) -> Dict[str, Any]:
      def generate_random_value(hparam: Any) -> Any:
          if isinstance(hparam, Dict):
              if "type" not in hparam:
                  # In this case we have a dictionary of nested hyperparameters.
                  return _generate_random_hparam_values(hparam)
              elif hparam["type"] == "const":
                  return hparam["val"]
              elif hparam["type"] == "int":
                  return random.randint(
                      hparam["minval"], hparam["maxval"]
                  )
              elif hparam["type"] == "double":
                  return random.uniform(
                      hparam["minval"], hparam["maxval"]
                  )
              elif hparam["type"] == "categorical":
                  return random.choice(hparam["vals"])
              elif hparam["type"] == "log":
                  return math.pow(
                      hparam["base"],
                      random.uniform(
                          hparam["minval"], hparam["maxval"]
                      ),
                  )
              else:
                  raise Exception(
                      "Wrong type of hyperparameter: {}".format(
                          hparam["type"]
                      )
                  )
          elif isinstance(hparam, (int, float, str, list, type(None))):
              return hparam
          else:
              raise Exception(
                  "Wrong type of hyperparameter: {}".format(
                      type(hparam)
                  )
              )
  
      hparams = {
          name: generate_random_value(hparam_def[name])
          for name in hparam_def
      }
      return hparams
  
imports: import contextlib
  import logging
  import math
  import os
  import pathlib
  import random
  import sys
  import uuid
  from typing import Any, Dict, Iterator, List, Optional, Tuple, Type
  import determined
  from determined import constants, core, gpu, load
label_desc: Use image node_id 3 for calling a global function with example usage: _generate_random_hparam_values(hparam_def) and returns: hparams, _generate_random_hparam_values, hparam, hparam, random, random, random, math