HomeTechniques and Tips@RISK: General QuestionsDifferent Results with the Same Fixed Seed for various distributions

# 2.5. Different Results with the Same Fixed Seed for various distributions

También disponible en Español: Resultados diferentes con la misma semilla fija para varias distribuciones

Problem:

When comparing the random numbers sequence generated for each distribution in a model, they are different when simulated with these scenarios:

1. Simulate and compare random number sequences for the same model simulated with @RISK and a Custom Development API run with PCR or SDK.
2. Simulate and compare the random number sequences for the same model simulated simultaneously with two open workbooks. See also Different Results with Multiple Workbook Copies

Explanation:

The difference can occur because distributions in the model are defined differently. One model could have more distributions or the same number of distributions, but these were defined in a different order.

Since @RISK is sampling a different number of distributions or a list of distributions ordered differently, they are effectively distinct models, and the same results should not be expected.  The same model will always produce the same results using the same fixed seed.

For example, suppose I am using a fixed seed that happens to generate the following numbers using RiskUniform(0,1):  0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7.  (Of course, a pattern like this is enormously unlikely; it's just chosen to make the example easy to follow.)

If I use that same fixed seed and run a simulation with seven iterations, I will always get those values precisely in that order.  In other words:

Iteration    value of RiskUniform(0,1)

1                 0.1
2                 0.2
3                 0.3
4                 0.4

One difference is the number of distributions. So, if I add another RiskUniform(0,1) to the spreadsheet and run seven iterations, the results will be different.  The same seed list is generated and used, but now two distributions are sampled from it.  In other words:

Iteration    Value of first RiskUniform(0,1)    Value of second RiskUniform(0,1)
1                 0.1                                          0.2
2                 0.3                                          0.4
3                 0.5                                          0.6
4                 0.7                                          [next value in seeded list]

Another reason for the difference is distributions were defined in a different order. So if I add a RiskPoisson(5) and another RiskUniform(0,1), or first a RiskUniform and then a RiskPoisson and run seven iterations, the results will be different.  The same fixed seed is used, but now three distributions are sampled from it, and these are the numbers generated for the RiskPoisson: 2,4,7,5,1,3,6.

In other words:

 Iteration Value of first RiskUniform(0,1) Value of second RiskUniform(0,1) value of RiskPoisson(5) 1 0.1 0.2 7.0 2 0.4 0.5 3.0 3 0.7 [next value in seeded list]

Or, with a different order

 Iteration Value of first RiskUniform(0,1) Value of RiskPoisson(5) Value of second RiskUniform(0,1) 1 0.1 4.0 0.3 2 0.4 1.0 0.6 3 0.7 [next value in seeded list]

The first model with only one distribution will always produce the same results for the same fixed seed.

The other models with two or three distributions will always have the same random number sequence for the same fixed seed. But the samples will not be the same because they are assigned differently. Ultimately, all samples converge to the same desired distributions, that is, the same statistics, making their results correct and comparable.

Also, consider that If Latin Hypercube sampling is in effect, we can no longer draw purely random samples since we need to ensure that a random sample is drawn from each Latin Hypercube bin. For this reason, you can see that samples will not be identical after a few iterations and will only match the last digits. Read more about this in: Latin Hypercube Versus Monte Carlo Sampling

If identical answers are critical, perhaps another approach is in order. These are some possible solutions:

1. Use Monte Carlo as your Sampling Type.
2. Supply the variable data directly.  For instance, distribute a list of numbers saying, "Here are the monthly interest rates for the next five years."
3. Add the RiskSeed property function to each distribution in the model. This way, each distribution will have its unique sequence of random numbers, no matter their defined order.

Last update: 2023-02-09

Knowledge Tags