How to generate same set of random numbers?
Mostra commenti meno recenti
How to generate same set of random numbers time and again?
Risposta accettata
Più risposte (2)
Walter Roberson
il 12 Ott 2016
1 voto
See rng() if you are using a reasonably recent MATLAB.
1 Commento
Will Smith
il 12 Ott 2016
Yaxuan Li
il 13 Lug 2021
Modificato: Walter Roberson
il 13 Lug 2021
Why this doens't work for me?
rng(1,'twister');
x = rand(1,5)
x =
0.4170 0.7203 0.0001 0.3023 0.1468
x = rand(1,5)
x =
0.0923 0.1863 0.3456 0.3968 0.5388
1 Commento
You need to reset the seed.
rng(1,'twister');
x = rand(1,5)
rng(1,'twister');
x = rand(1,5)
Categorie
Scopri di più su Random Number Generation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!