Mersenne Twister RNG init_by_array

Hi,
Can I init Mersenne Twister with array as a seed? (The C mt19937ar implementation support it: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html)
Thanks

 採用された回答

Jan
Jan 2017 年 6 月 20 日
編集済み: Jan 2017 年 6 月 20 日

0 投票

No, this is not possible in Matlab. As far as I know, you can seed it with 32 bits only - but I'm still such surprised about this, that I hope I've overseen a detail.

1 件のコメント

Noam Mazor
Noam Mazor 2017 年 6 月 22 日
Thanks! Is there a simple way to use the C implementation as an external lib and to initialize it from there?

サインインしてコメントする。

その他の回答 (1 件)

Peter Perkins
Peter Perkins 2017 年 6 月 28 日

0 投票

The "array" you are talking about is typically a state vector, right? You can set the generator state:
>> r = RandStream.getGlobalStream
r =
mt19937ar random stream (current global stream)
Seed: 0
NormalTransform: Ziggurat
>> s = r.State;
>> rand(1,5)
ans =
0.09754 0.2785 0.54688 0.95751 0.96489
>> r.State = s;
>> rand(1,5)
ans =
0.09754 0.2785 0.54688 0.95751 0.96489

1 件のコメント

Noam Mazor
Noam Mazor 2017 年 6 月 28 日
Hi, No, the C implementation has a function (init_by_array) that maps arbitrary array (in any length) into a state vector.
Thanks!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeRandom Number Generation についてさらに検索

質問済み:

2017 年 6 月 20 日

コメント済み:

2017 年 6 月 28 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by