Control random number generation

2 views (last 30 days)
Yro
Yro on 28 May 2021
Answered: Rik on 28 May 2021
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.

Accepted Answer

Rik
Rik on 28 May 2021
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.

More Answers (0)

Categories

Find more on Random Number Generation in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!