2

Why do two flowcharts set up exactly the same as shown in the image below produce different results for every simulation run?

How would one go about ensuring they are exactly the same?

enter image description here

Thanks!

Jaco-Ben Vosloo
  • 3,770
  • 2
  • 16
  • 33

1 Answers1

1

The problem is that they all sample from the same random data stream thus impacting the number the next item will sample

In order to solve this, you need to provide them each their own random object, with the same seed, so that they each have the same stream of random numbers.

See the example below where both the flow charts have exactly the same setup and the same results.

enter image description here

I simply created a random object for both the source and delay blocks for each stream and use them in the distributions. That way I am sure they all have unique, but identical random data streams.

enter image description here

enter image description here

Jaco-Ben Vosloo
  • 3,770
  • 2
  • 16
  • 33
  • 1
    You only need separate random number generators (`Random` instances) per process; there is no need to break it down further for each 'user' of randomness. (Though, more generally, it can sometimes be useful to do this kind of further separation to isolate the randomness in different subsets of your model, particularly for things like testing where you might want 'subsystem A' to do identical things than it did last time when you've added a new subsystem which also uses randomness.) – Stuart Rossiter Jul 08 '21 at 09:21