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

3 次查看(过去 30 天)
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.

回答(1 个)

John Chilleri
John Chilleri 2016-12-26
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!

类别

Help CenterFile Exchange 中查找有关 Random Number Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by