Temporarily set the random seed, and then restore it when exiting the context.
(self, seed)
| 155 | |
| 156 | class TemporarilySeededRandom: |
| 157 | def __init__(self, seed): |
| 158 | """Temporarily set the random seed, and then restore it when exiting the context.""" |
| 159 | self.seed = seed |
| 160 | self.stored_state = None |
| 161 | self.stored_np_state = None |
| 162 | |
| 163 | def __enter__(self): |
| 164 | # Store the current random state |
nothing calls this directly
no outgoing calls
no test coverage detected