Why random number blocks have the same randomness?

2 views (last 30 days)
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?

Accepted Answer

dpb
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...
  1 Comment
israa
israa on 9 Sep 2014
Thanks alot ..I change the RNG to produce unrepeatable random numbers , and its work good

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!