class_docstr: CartPoleMassEnv varies the weights of the cart and the pole.
class_docstr_tok: ["CartPoleMassEnv","varies","the","weights","of","the","cart","and","the","pole","."]
code: def sample_tasks(self, n_tasks):
      # Sample new cart- and pole masses (random floats between 0.5 and 2.0
      # (cart) and between 0.05 and 0.2 (pole)).
      cart_masses = np.random.uniform(
          low=0.5, high=2.0, size=(n_tasks, 1)
      )
      pole_masses = np.random.uniform(
          low=0.05, high=0.2, size=(n_tasks, 1)
      )
      return np.concatenate([cart_masses, pole_masses], axis=-1)
  
file_path: ray/python/ray/rllib/examples/env/cartpole_mass.py
imports: from gymnasium.envs.classic_control.cartpole import CartPoleEnv
  from gymnasium.utils import EzPickle
  import numpy
  from ray.rllib.env.apis.task_settable_env import TaskSettableEnv
label_desc: Use image node_id 1 for calling the CartPoleMassEnv obj's underlying member method code with example usage: obj.sample_tasks(n_tasks) and returns: np