class_docstr: Hand-coded policy that returns random actions.
class_docstr_tok: ["Hand-coded","policy","that","returns","random","actions","."]
code: def compute_actions(
      self,
      obs_batch: Union[List[TensorStructType], TensorStructType],
      state_batches: Optional[List[TensorType]] = None,
      prev_action_batch: Union[
          List[TensorStructType], TensorStructType
      ] = None,
      prev_reward_batch: Union[
          List[TensorStructType], TensorStructType
      ] = None,
      **kwargs,
  ):
      # Alternatively, a numpy array would work here as well.
      # e.g.: np.array([random.choice([0, 1])] * len(obs_batch))
      obs_batch_size = len(tree.flatten(obs_batch)[0])
      return (
          [
              self.action_space_for_sampling.sample()
              for _ in range(obs_batch_size)
          ],
          [],
          {},
      )
  
file_path: ray/python/ray/rllib/examples/policy/random_policy.py
imports: from gymnasium.spaces import Box
  import numpy
  import random
  import tree
  from typing import List, Optional, Union
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.typing import ModelWeights, TensorStructType, TensorType
label_desc: Use image node_id 3 for calling the RandomPolicy obj's underlying member method code with example usage: obj.compute_actions(obs_batch, state_batches, prev_action_batch, prev_reward_batch) and returns: unknown,  list,  dict