[Numpy-tickets] [NumPy] #581: random.set_state does not reset state of random.standard_normal

NumPy numpy-tickets@scipy....
Mon Sep 17 10:31:44 CDT 2007

#581: random.set_state does not reset state of random.standard_normal
 Reporter:  Yung-Chin Oei  |       Owner:  somebody
     Type:  defect         |      Status:  new     
 Priority:  normal         |   Milestone:          
Component:  numpy.random   |     Version:  1.0.1   
 Severity:  normal         |    Keywords:          
 When calling random.set_state the function random.standard_normal may
 return an internally retained old number before starting to use the new
 state of the generator.

 I think this happens because the Box-Muller algorithm generates normally
 distributed numbers in pairs. If an uneven number of calls to the function
 was made before using set_state, the second number of such a pair is
 returned before new numbers are generated.

 Maybe useful for fixing this problem: using random.seed(0) does seem to
 properly reset the internal state of random.standard_normal - the next
 call to standard_normal always returns the expected new random number.

Ticket URL: <http://scipy.org/scipy/numpy/ticket/581>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list