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

Charles R Harris charlesr.harris@gmail....
Sun Jun 13 12:29:38 CDT 2010


On Sun, Jun 13, 2010 at 11:17 AM, Vincent Davis <vincent@vincentdavis.net>wrote:

> On Sun, Jun 13, 2010 at 9:46 AM, Matthew Brett <matthew.brett@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.
>
> Should there be a test added for this type of error?
>
>
Yes, open a ticket. Strictly speaking we should probably test all the
distributions, but just having something for the uniform and normal
distributions would be a good start. They don't need to be long, just
picking a seed (42?) and generating a couple of values should be sufficient.
The floating results can't be expected to be exact due to various hardware
floating implementations, but they should be exact to a reasonable number of
figures.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20100613/06e75355/attachment.html 


More information about the SciPy-Dev mailing list