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

Nicolas Pinto pinto at mit.edu
Mon Feb 23 07:11:49 EST 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
http://web.mit.edu/pinto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090223/43e0b23a/attachment.html>


More information about the NumPy-Discussion mailing list