[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Generate same rand sequence in Octave, Matlab
From: |
John W. Eaton |
Subject: |
Generate same rand sequence in Octave, Matlab |
Date: |
Thu, 8 Dec 2011 20:03:37 -0500 |
On 8-Dec-2011, Steve Thompson wrote:
| Hi list,
|
| I'm trying to figure out if it is possible to get the same rand (and randn)
| sequence in Matlab (2007) and Octave.
|
| In Matlab (7.4.0.287 (R2007a)) I get:
| >> rand('state', 0)
| >> rand
| ans = 0.9501
|
| In Octave (3.2.4) I get:
| octave:1> rand('state', 0)
| octave:2> rand
| ans = 0.84442
|
| It is possible to get the same sequence?
I think the random number generator in Matlab has changed in the
past and I don't know of anything that says they won't do it
again, so you might not get the same sequence if you use different
versions of Matlab.
jwe