Seed Python and NumPy RNGs for reproducibility.
(seed_value: Optional[int] = None)
| 136 | |
| 137 | |
| 138 | def seed_random_generators(seed_value: Optional[int] = None): |
| 139 | """Seed Python and NumPy RNGs for reproducibility.""" |
| 140 | if seed_value is None: |
| 141 | return |
| 142 | seed(seed_value) |
| 143 | # Try to seed NumPy's random number generator |
| 144 | # This handles both NumPy 1.x and 2.x, and any import issues |
| 145 | if numpy_available: |
| 146 | try: |
| 147 | np.random.seed(seed_value) |
| 148 | except (ImportError, AttributeError, Exception): |
| 149 | pass |
| 150 | |
| 151 | |
| 152 | def test_library_properties(): |
no outgoing calls
no test coverage detected
searching dependent graphs…