Why random number blocks have the same randomness?
2 views (last 30 days)
Show older comments
Hi all
I have 10 nodes , each with trigger input. When there is a trigger hit the node will send a message.
The trigger consist of two Random Source blocks with one Relational Operator block ( < operand) as shown in first picture.
The first Random Source block parameters : min number 1 , max number 10
The second Random Source block parameters : min number 1 , max number 5
The problem is that all the 10 nodes have the same trigger input value (as shown in second picture), thats mean all Random Source blocks have the same randomness! Is this problem belongs to MATLAB solver issues?
0 Comments
Accepted Answer
dpb
on 9 Sep 2014
From the doc I find the following interesting note--
"To use other algorithms supported by MATLAB in a Simulink model, generate a stream of random numbers in MATLAB, and store the output as a .mat file. Use this .mat file as the random number input for your simulation. For more information, see Creating and Controlling a Random Number Stream. To create multiple independent streams using MATLAB, see Multiple streams."
"Note: Using multiple seeds to generate multiple parallel independent streams for a generator algorithm is not recommended for the mcg16807 algorithm. Instead, use the method described above."
Also, unless you set the seed to the RNG differently, it is documented that the result is repeatable for a given initial seed. I'd presume this is probably the cause of your getting the same generation from each.
NB: I've never seen a Simulink installation; just reading the doc...
More Answers (0)
See Also
Categories
Find more on Sources in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!