Control random number generation

1 次查看(过去 30 天)
Yro
Yro 2021-5-28
回答: Rik 2021-5-28
I have a question about the rng(seed) (random number generator) function. I have a code with which I call several functions in which random numbers are generated. In these functions is also used the seed that I defined in the main file?
Thanks in advance.

采纳的回答

Rik
Rik 2021-5-28
Slightly depending on what you mean: yes.
The random number generation has a global state, so it doesn't matter if the call is nested in a function or not.

更多回答(0 个)

类别

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

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by