Why are the random numbers obtained by different invocations to LOGRND() the same?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I used the LOGRND()[https://www.mathworks.com/help/stats/lognrnd.html] funtion to conduct a Monte Carlo Experiment. I used to two different functions(both are attached below) to call logrnd and stored the results in different mat files. The m-files are run remotely in a node using parallel computing.
However, the random parameters resulting from the two different invocations to logrnd are the same. How is this possible ?
Will using rng('shuffle') before calling logrnd() help ?
Appreciate the help.
0 Kommentare
Antworten (1)
John Chilleri
am 26 Dez. 2016
Hello,
This is possible because the two different invocations are running off the same initial seed, causing the same values to be generated.
Furthermore, using rng('shuffle') may not solve the problem, as it generates a random seed based on the current time; however, we might be able to get around this by placing a pause(some amount of time) in one of your functions before the use of rng('shuffle').
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Random Number Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!