r"""Turn `seed` into a np.random.RandomState instance Parameters ---------- seed : None | int | instance of RandomState If `seed` is None, return the RandomState singleton used by np.random. If `seed` is an int, return a new RandomState instance seeded with `seed`.
(seed)
| 582 | |
| 583 | |
| 584 | def check_random_state(seed): |
| 585 | r"""Turn `seed` into a np.random.RandomState instance |
| 586 | |
| 587 | Parameters |
| 588 | ---------- |
| 589 | seed : None | int | instance of RandomState |
| 590 | If `seed` is None, return the RandomState singleton used by np.random. |
| 591 | If `seed` is an int, return a new RandomState instance seeded with `seed`. |
| 592 | If `seed` is already a RandomState instance, return it. |
| 593 | Otherwise raise ValueError. |
| 594 | """ |
| 595 | if seed is None or seed is np.random: |
| 596 | return np.random.mtrand._rand |
| 597 | if isinstance(seed, (int, np.integer)): |
| 598 | return np.random.RandomState(seed) |
| 599 | if isinstance(seed, np.random.RandomState): |
| 600 | return seed |
| 601 | raise ValueError( |
| 602 | "{} cannot be used to seed a numpy.random.RandomState instance".format(seed) |
| 603 | ) |
| 604 | |
| 605 | |
| 606 | def get_coordinate_circle(x): |
no outgoing calls
no test coverage detected