class_docstr: An exploration that simply samples from a distribution.
  
  The sampling can be made deterministic by passing explore=False into
  the call to `get_exploration_action`.
  Also allows for scheduled parameters for the distributions, such as
  lowering stddev, temperature, etc.. over time.
class_docstr_tok: ["An","exploration","that","simply","samples","from","a","distribution",".","The","sampling","can","be","made","deterministic","by","passing","explore=False","into","the","call","to","`","get_exploration_action","`",".","Also","allows","for","scheduled","parameters","for","the","distributions",",","such","as","lowering","stddev",",","temperature",",","etc","..","over","time","."]
docstr: Initializes a StochasticSampling Exploration object.
  
  Args:
      action_space: The gym action space used by the environment.
      framework: One of None, "tf", "torch".
      model: The ModelV2 used by the owning Policy.
      random_timesteps: The number of timesteps for which to act
          completely randomly. Only after this number of timesteps,
          actual samples will be drawn to get exploration actions.
docstr_tok: ["Initializes","a","StochasticSampling","Exploration","object",".","Args",":","action_space",":","The","gym","action","space","used","by","the","environment",".","framework",":","One","of","None",",","``","tf","''",",","``","torch","''",".","model",":","The","ModelV2","used","by","the","owning","Policy",".","random_timesteps",":","The","number","of","timesteps","for","which","to","act","completely","randomly",".","Only","after","this","number","of","timesteps",",","actual","samples","will","be","drawn","to","get","exploration","actions","."]
code: def __init__(
      self,
      action_space: gym.spaces.Space,
      *,
      framework: str,
      model: ModelV2,
      random_timesteps: int = 0,
      **kwargs,
  ):
      """Initializes a StochasticSampling Exploration object.
  
      Args:
          action_space: The gym action space used by the environment.
          framework: One of None, "tf", "torch".
          model: The ModelV2 used by the owning Policy.
          random_timesteps: The number of timesteps for which to act
              completely randomly. Only after this number of timesteps,
              actual samples will be drawn to get exploration actions.
      """
      assert framework is not None
      super().__init__(
          action_space, model=model, framework=framework, **kwargs
      )
  
      # Create the Random exploration module (used for the first n
      # timesteps).
      self.random_timesteps = random_timesteps
      self.random_exploration = Random(
          action_space,
          model=self.model,
          framework=self.framework,
          **kwargs,
      )
  
      # The current timestep value (tf-var or python int).
      self.last_timestep = get_variable(
          np.array(0, np.int64),
          framework=self.framework,
          tf_name="timestep",
          dtype=np.int64,
      )
  
file_path: ray/python/ray/rllib/utils/exploration/stochastic_sampling.py
imports: import functools
  import gymnasium
  import numpy
  from typing import Optional, Union
  from ray.rllib.models.action_dist import ActionDistribution
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.utils.annotations import override, PublicAPI
  from ray.rllib.utils.exploration.exploration import Exploration
  from ray.rllib.utils.exploration.random import Random
  from ray.rllib.utils.framework import get_variable, try_import_tf, try_import_torch, TensorType
  from ray.rllib.utils.tf_utils import zero_logps_from_actions
label_desc: Use image node_id 1 to create a new StochasticSampling object from inherited base classes: Exploration with example: obj = StochasticSampling(action_space)