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

Charles R Harris charlesr.harris@gmail....
Sun Jun 13 17:16:56 CDT 2010


On Sun, Jun 13, 2010 at 3:20 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Sun, Jun 13, 2010 at 12:17, 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.
>
> 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).
>
>
I've been thinking that the ziggurat implementation should be added as a
separate function, znormal or zignomal, perhaps together with a fast version
returning lower precision that could be helpful in simulating noise.

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


More information about the SciPy-Dev mailing list