Thu 19 Nov 2015 02:04:17 PM UTC, comment #5:
This doesn't seem to hold for randn, tried with
Octave 4.0.0:
>> randn('twister', twister_seed(5489));
>> randn(1,5)
ans =
1.362259 0.071959 0.203598 -0.096973 1.324298
Matlab R2015a:
>> rng(5489, 'twister');
>> randn(1,5)
ans =
0.5377 1.8339 -2.2588 0.8622 0.3188
Also tried flipping the last state vector value as decribed (in both Matlab and Octave), randn still produces different streams.
Matlab also seems to use the Ziggurat method, so can't figure out where the difference is.
>> RandStream.getGlobalStream
ans =
mt19937ar random stream (current global stream)
Seed: 5489
NormalTransform: Ziggurat
Oddly enough, Matlab always seems to produce the same randn sequence no matter what the seed number is, i.e. rng(0, 'twister') and rng(5489, 'twister') generate the same 625 state vector when queried with s = rng
|