Random numbers seed setting
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I am using randn('seed', 1) at the beginning of my code for a simulation with 1000 replications. This is to make sure that if I rerun the simulation I'll get same results every time. But I am getting slightly different results in different runs. Can anyone help? I am using Matlab 2012a.
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 19 Avr 2013
Use
a=rng;
out=randn
rng(a)
out=randn
6 commentaires
Digitalsd
le 19 Avr 2013
In addition you can use the code:
stream = RandStream('mt19937ar','seed',1);
RandStream.setGlobalStream(stream);
randn
stream = RandStream('mt19937ar','seed',1);
RandStream.setGlobalStream(stream);
randn
"mt19937ar" indicates the used p.s.random generator algorithm
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Results, Reporting, and Test File Management dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!