This is documentation for an old release of Scikit-learn (version 0.24). Try the latest stable release (version 1.6) or development (unstable) versions.

sklearn.utils.check_random_state

sklearn.utils.check_random_state(seed)[source]

Turn seed into a np.random.RandomState instance

Parameters
seedNone, int or 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. If seed is already a RandomState instance, return it. Otherwise raise ValueError.

Examples using sklearn.utils.check_random_state