Random seeding in open AI gym

Viewed 1361

I have a question about seeding in open AI gym and utilizing it in custom environments. Let's take the lunar lander environment for example, the default seeding function is:

def seed(self, seed=None):
    self.np_random, seed = seeding.np_random(seed)
    return [seed]

And when generating they use:

height = self.np_random.uniform(0, H/2, size=(CHUNKS+1,) )

My question is, if I make a custom environment and use numpy or sci stats I would need to seed with np.random.seed() to get an effect. How should I use self.np_random.to seed in my custom environment? If I use np.random.uniform(0,0.02)? Should I use self.np_random.uniform(0,0.02) instead? What about sci-stats? How should I use it there if I use scipy.stats.truncnorm.rvs()? Any consequence if I just set np.random.seed(seed)?

I am using this workaround now: Can I create a local numpy random seed?

Is there a better solution?

0 Answers
Related