[Numpy-discussion] random permutation

Keith Goodman kwgoodman at gmail.com
Sat Jan 13 13:26:45 EST 2007


On 1/13/07, Sebastian Haase <seb.haase at gmx.net> wrote:
> On 1/13/07, Keith Goodman <kwgoodman at gmail.com> wrote:
> > On 1/11/07, Robert Kern <robert.kern at gmail.com> wrote:
> > > Keith Goodman wrote:
> > > > Why is the first element of the permutation always the same? Am I
> > > > using random.permutation in the right way?
> > >
> > > >>> M.__version__
> > > > '1.0rc1'
> > >
> > > This has been fixed in more recent versions.
> > >
> > >   http://projects.scipy.org/scipy/numpy/ticket/374
> >
> > I don't see any unit tests for numpy.random. I guess randomness is hard to test.
> >
> > Would it help to seed the random number generator and at least check
> > that you get the same result you got before? No existing problems
> > would be found. But new ones might be caught.
> >
> Hi,
> Is it guaranteed that a given seed produces the same sequence of
> rand-number between different platforms ?
> I thought this might only be guaranteed for "any given computer" to
> reproduce the same numbers.

I hope, and expect, that it is system independent.

Here's what I get:

>> rs = numpy.random.RandomState([123, 901, 789])
>> rs.randn(4,1)

array([[ 0.76072026],
       [ 1.27712191],
       [ 0.03497453],
       [ 0.09056668]])
>> rs.rand(4,1)

array([[ 0.184306  ],
       [ 0.58967936],
       [ 0.52425903],
       [ 0.33389408]])
>> numpy.__version__
'1.0.1'

Linux kel 2.6.18-3-686 #1 SMP Mon Dec 4 16:41:14 UTC 2006 i686 GNU/Linux



More information about the NumPy-Discussion mailing list