Effacer les filtres
Effacer les filtres

Why are the random numbers obtained by different invocations to LOGRND() the same?

2 vues (au cours des 30 derniers jours)
Aditya Nanda
Aditya Nanda le 25 Déc 2016
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.

Réponses (1)

John Chilleri
John Chilleri le 26 Déc 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!

Catégories

En savoir plus sur Random Number Generation dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by