# How choosing a value for random_state argument in sklearn.model_selection works?

I have been using sklearn for quite some time and I understand using the same number say 100 or 200 as a value for the random_state argument will help me to produce the similar train and test data sets. However, how does it work?

Is it some kind of initialization? Do we need to pick a value based on data size? I want to know how random_state works.

Obviously, the way you use it falls into the first use case. Thus, the number is used as a seed for the pseudorandom number generator. When you have the seed hardcoded as a parameter, you use the same seed for a second time. This will result in the same sequence of pseudorandom numbers, thus not random at all. Because of this, use numeric seeds only for testing purposes when you want to reproduce your "randomness". For learning experiments and production purposes, you can just leave the default None value.