Create variable number of random streams (unique, deterministic, independent)
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
AJ
el 14 de Abr. de 2022
Comentada: AJ
el 14 de Abr. de 2022
For our simulations, we wish to have repeatable (pseudo-)random number generation.
The problem with using a "global " random stream is that it is possibly shared with other MATLAB processes, which can corrput (make non-repeatable) the random generation.
Now, this is solved in part by the 'NumStreams' argument to RandStream.create, e.g.:
[s1,s2,s3,s4] = RandStream.create('mrg32k3a','NumStreams',4)
This creates four unique, deterministic, independent random number streams.
The problem: The left hand side is fixed at four elements.
The question: How do I generalize this to handle a variable number of random number streams? For example:
[???] = RandStream.create('mrg32k3a','NumStreams',K)
I can think of some ad hoc approaches (e.g. using one stream to generate seeds for the remaining streams) but I worry about true independence of the streams.
0 comentarios
Respuesta aceptada
Steven Lord
el 14 de Abr. de 2022
See the "Substreams" and "Restore State of Random Number Generator to Reproduce Output" sections on this documentation page for more information.
Más respuestas (1)
Ver también
Categorías
Más información sobre Random Number Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!