rlberry.seeding
.safe_reseed¶
- rlberry.seeding.safe_reseed(obj, seeder, reseed_spaces=True)[source]¶
Calls obj.reseed(seed_seq) method if available; If a obj.seed() method is available, call obj.seed(seed_val), where seed_val is generated by the seeder. Otherwise, does nothing.
- Parameters:
- objobject
Object to be reseeded.
- seeder: :class:`~rlberry.seeding.seeder.Seeder`
Seeder object from which to generate random seeds.
- reseed_spaces: bool, default = True.
If False, do not try to reseed observation_space and action_space (if they exist as attributes of obj).
- Returns:
- True if reseeding was done, False otherwise.