class_docstr: Unit-test mock environment.
  
  Args:
      states: States specification.
      actions: Actions specification.
      min_timesteps: Minimum number of timesteps.
code: def random_states_function(cls, states_spec, actions_spec=None):
      if actions_spec is None:
          if "shape" in states_spec:
              return lambda: cls.random_state_function(
                  state_spec=states_spec
              )()
          else:
              return lambda: {
                  name: cls.random_state_function(
                      state_spec=state_spec
                  )()
                  for name, state_spec in states_spec.items()
              }
  
      elif "shape" in states_spec:
          if "type" in actions_spec:
  
              def fn():
                  random_states = cls.random_state_function(
                      state_spec=states_spec
                  )()
                  if actions_spec["type"] == "int":
                      if not isinstance(random_states, dict):
                          random_states = dict(state=random_states)
                      mask = cls.random_mask(action_spec=actions_spec)
                      random_states["action_mask"] = mask
                  return random_states
  
          else:
  
              def fn():
                  random_states = cls.random_state_function(
                      state_spec=states_spec
                  )()
                  for name, action_spec in actions_spec.items():
                      if action_spec["type"] == "int":
                          if not isinstance(random_states, dict):
                              random_states = dict(state=random_states)
                          mask = cls.random_mask(
                              action_spec=action_spec
                          )
                          random_states[name + "_mask"] = mask
                  return random_states
  
      else:
          if "type" in actions_spec:
  
              def fn():
                  random_states = {
                      name: cls.random_state_function(
                          state_spec=state_spec
                      )()
                      for name, state_spec in states_spec.items()
                  }
                  if actions_spec["type"] == "int":
                      mask = cls.random_mask(action_spec=actions_spec)
                      random_states["action_mask"] = mask
                  return random_states
  
          else:
  
              def fn():
                  random_states = {
                      name: cls.random_state_function(
                          state_spec=state_spec
                      )()
                      for name, state_spec in states_spec.items()
                  }
                  for name, action_spec in actions_spec.items():
                      if action_spec["type"] == "int":
                          mask = cls.random_mask(
                              action_spec=action_spec
                          )
                          random_states[name + "_mask"] = mask
                  return random_states
  
      return fn
  
file_path: tensorforce/test/unittest_environment.py
imports: from collections import OrderedDict
  from random import random
  import numpy
  from tensorforce import Environment, TensorforceError, util
label_desc: Use image node_id 4 for calling the UnittestEnvironment obj's underlying member method code with example usage: obj.random_states_function(cls, states_spec, actions_spec) and returns: fn, function, function, random_states, random_states, random_states, random_states