title: What exactly does the Pandas random_state do?
body: <p>I have the following code where I use the Pandas <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sample.html" rel="noreferrer">random_state</a></p>
  
  <pre><code>randomState = 123
  sampleSize = 750
  df = pd.read_csv(filePath, delim_whitespace=True)
  df_s = df.sample(n=sampleSize, random_state=randomState)
  </code></pre>
  
  <p>This generates a sample dataframe <code>df_s</code>. Every time I run the code with the same <code>randomState</code>, I get the same sample <code>df_s</code>. When I change the value from <code>123</code> to <code>12</code> the sample changes as well, so I guess that's what the <code>random_state</code> does.</p>
  
  <p>My silly question: How do the number change affect the sample change?
  I read the <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sample.html" rel="noreferrer">Pandas documentation</a>  and the <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.RandomState.html" rel="noreferrer">Numpy documentation</a>, but could not get a clear picture.</p>
  
  <p>Any straight forward explanation with an example will be much appreciated.</p>