[Numpy-discussion] How to generate equivalent "random" numbers in matlab and numpy?

Nicolas Pinto pinto@mit....
Mon Feb 23 06:11:49 CST 2009

Dear all,

I'd like to generate equivalent sequences of 'random' numbers in matlab and
numpy, is there any way I can do that? I tried to fix the seed (see below)
but it doesn't work.

# numpy
In [29]: np.random.seed(1); np.random.permutation(5)+1
Out[29]: array([3, 2, 5, 1, 4])

% matlab
>> rand('seed', 1); randperm(5)

ans =

     4     3     5     2     1

Thanks for your time.

Best regards,

Nicolas Pinto
Ph.D. Candidate, Brain & Computer Sciences
Massachusetts Institute of Technology, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090223/43e0b23a/attachment.html 

More information about the Numpy-discussion mailing list