rand() gives the same values in each run
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hamza Belm
am 3 Aug. 2020
Kommentiert: Steven Lord
am 4 Aug. 2020
Hi
I'm working on the evaluation of metaheuristic algorithms and i need to test each technique in many runs, however the rand() function always generates the same random values in each run, which is not good for the evaluation.
For example, if rand()=0.56 in the 1st run at the 2nd iteration, then rand()=0.56 for all the other runs at the second iteration.
2 Kommentare
Akzeptierte Antwort
Steven Lord
am 3 Aug. 2020
Are you initializing the random number generator with rng too frequently or in the wrong place in your code flow?
2 Kommentare
Steven Lord
am 4 Aug. 2020
Show a full (small) segment of code that we can run that demonstrates the behavior you described.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!