Random.state code example

Example 1: random_state

Here you pass an integer, which will act as the seed for the random number generator during the split. Or, you can also pass an instance of the RandomState class, which will become the number generator. If you don’t pass anything, the RandomState instance used by np.random will be used instead.

Example 2: what is random state

The random state is simply the lot number of the set generated randomly in any operation. We can specify this lot number whenever we want the same set again.