Utilities to Support Random State Infrastructure
import numpy as np
Check the random state of a given seed.
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.
If seed is already a RandomState instance, return it.
Otherwise raise ValueError.
1. This code was sourced from scikit-learn
if seed is None or seed is np.random:
if isinstance(seed, (numbers.Integral, np.integer)):
if isinstance(seed, np.random.RandomState):
raise ValueError('%r cannot be used to seed a numpy.random.RandomState'
' instance' % seed)