[SciPy-Dev] seeded randn gets different values on osx

Robert Kern robert.kern at gmail.com
Sun Jun 13 17:27:00 EDT 2010


On Sun, Jun 13, 2010 at 16:25,  <josef.pktd at gmail.com> wrote:
> On Sun, Jun 13, 2010 at 5:20 PM, Robert Kern <robert.kern at gmail.com> wrote:
>> On Sun, Jun 13, 2010 at 12:17, Vincent Davis <vincent at vincentdavis.net> wrote:
>>>
>>> On Sun, Jun 13, 2010 at 9:46 AM, Matthew Brett <matthew.brett at gmail.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> >> After a little discusion with Josef here are some results. It appears
>>>> >> to me that osx gets different values from a seeded randn
>>>> >
>>>> >> On my machine OSX py 2.6.5, numpy 1.4.0 scipy 8.0b
>>>> >>>>>> np.random.seed(0)
>>>> >>>>>> np.random.randn(3)
>>>> >>> array([ 0.06897149,  1.32078057,  1.5997924 ])
>>>>
>>>> Nor in a numpy-1.4.0 virtualenv:
>>>>
>>>> In [1]: import numpy as np
>>>>
>>>> In [2]: np.__version__
>>>> Out[2]: '1.4.0'
>>>>
>>>> In [3]: np.random.seed(0)
>>>>
>>>> In [4]: np.random.randn(3)
>>>> Out[4]: array([ 1.76405235,  0.40015721,  0.97873798])
>>>
>>> I just built 2.6 from current daily snapshot and installed numpy. Now I get the right answer
>>> MacBookPro-new-2:~ vmd$ py26
>>> Python 2.6.5+ (release26-maint, Jun 13 2010, 10:02:04)
>>> [GCC 4.2.1 (Apple Inc. build 5659)] on darwin
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> >>> import numpy
>>> >>> import numpy as np
>>> >>> np.random.seed(0)
>>> >>> np.random.randn(3)
>>> array([ 1.76405235,  0.40015721,  0.97873798])
>>> So I guess there is something wrong with the enthought 6.2 dist.
>>
>> It was an intentional, but poorly thought out change. Ilan Schnell
>> implemented a fast ziggurat algorithm for generating normal variates.
>> I think we will be reverting this modification for the stock numpy in
>> EPD (but don't quote me on that).
>
> It makes testing and bug-hunting a bit difficult if there are
> different versions of numpy with the same version number.

Hence, poorly thought out.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco



More information about the SciPy-Dev mailing list