Mersenne Twister RNG init_by_array

 Respuesta aceptada

Jan
Jan el 20 de Jun. de 2017
Editada: Jan el 20 de Jun. de 2017

0 votos

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 comentario

Noam Mazor
Noam Mazor el 22 de Jun. de 2017
Thanks! Is there a simple way to use the C implementation as an external lib and to initialize it from there?

Iniciar sesión para comentar.

Más respuestas (1)

Peter Perkins
Peter Perkins el 28 de Jun. de 2017
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 comentario

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

Iniciar sesión para comentar.

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Preguntada:

el 20 de Jun. de 2017

Comentada:

el 28 de Jun. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by