title: Best way to revert to a random seed after temporarily fixing it?
body: <p>Is this the only way to 'unseed' the random number generator:</p>
  
  <pre><code>np.random.seed(int(time.time()))
  </code></pre>
  
  <p>If you have some code that you want to be repeatable (e.g. a test) in a loop with other code that you want to be random each loop, how do you 'reset' the seed to random number generator after setting it?</p>
  
  <p>The following code illustrates the issue:</p>
  
  <pre><code>import numpy as np
  
  def test():
      np.random.seed(2)
      print("Repeatable test:", [np.random.randint(10) for i in range(3)])
  
  for i in range(4):
      print("Random number:", np.random.randint(10))
      test()
  
  Random number: 8
  Repeatable test: [8, 8, 6]
  Random number: 2
  Repeatable test: [8, 8, 6]
  Random number: 2
  Repeatable test: [8, 8, 6]
  Random number: 2
  Repeatable test: [8, 8, 6]
  </code></pre>
  
  <p>Desired result:  I want random number to be random each loop.</p>
  
  <p>I am happy to import the time module if this is the only way to do it but I thought there might be a simpler, more robust way.</p>
  
  <p>(You can't get the current seed according to <a href="https://stackoverflow.com/questions/32172054/how-can-i-retrieve-the-current-seed-of-numpys-random-number-generator">this post</a>)</p>