How to use the gym.utils.seeding.np_random function in gym

To help you get started, we’ve selected a few gym examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openai / gym / gym / envs / board_game / hex.py View on Github external
def _seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)

        # Update the random policy if needed
        if isinstance(self.opponent, str):
            if self.opponent == 'random':
                self.opponent_policy = make_random_policy(self.np_random)
            else:
                raise error.Error('Unrecognized opponent policy {}'.format(self.opponent))
        else:
            self.opponent_policy = self.opponent

        return [seed]
github natolambert / dynamicslearn / learn / envs / rigidbody.py View on Github external
def seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)
        return [seed]
github mjedmonds / OpenLock / gym_lock / envs / point_mass_lock_env.py View on Github external
def _seed(self, seed=None):
        """Sets the seed for this env's random number generator(s).

            Note:
                    Some environments use multiple pseudorandom number generators.
                    We want to capture all such seeds used in order to ensure that
                    there aren't accidental correlations between multiple generators.

            Returns:
                    list: Returns the list of seeds used in this env's random
                        number generators. The first value in the list should be the
                        "main" seed, or the value which a reproducer should pass to
                        'seed'. Often, the main seed equals the provided 'seed', but
                        this won't be true if seed=None, for example.
            """
        self.np_random, seed = seeding.np_random(seed)
        return [seed]
github openai / mlsh / gym / gym / envs / classic_control / pendulum.py View on Github external
def _seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)
        return [seed]
github BerkeleyAutomation / cloth_simulation / environment_rep / clothgym.py View on Github external
def _seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)
        return [seed]
github openai / gym / gym / envs / debugging / two_round_nondeterministic_reward.py View on Github external
def _seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)
        return [seed]
github honeynet / droidbot / droidbot / rl / env.py View on Github external
def seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)
        return [seed]
github openai / gym / gym / envs / toy_text / roulette.py View on Github external
def seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)
        return [seed]
github lerrel / gym-adv / gym / envs / .box2d / car_racing.py View on Github external
def _seed(self, seed=None):
        self.np_random, seed = seeding.np_random(seed)
        return [seed]