Palisade Knowledge Base

HomeTechniques and Tips@RISK Simulation: Numerical ResultsWhat Was My Random Number Seed?

6.8. What Was My Random Number Seed?

Applies to: @RISK 5.x–8.x

I've run a simulation, but it was with the random number seed set to "Choose Randomly". How can I find out what seed @RISK actually used, so that I can reproduce the simulation later?

If Quick Reports were run automatically at the end of the simulation, look at the Simulation Summary Information block on any of them. The Random Seed item gives you the random number seed that was actually used. If you haven't run Quick Reports, see Get a Quick Report for Just One Output, unless of course you want Quick Reports for all outputs.

In Version 8, the Quick Report is not available. The RiskSimulationInfo function can be used to determine the seed number instead. You can find more about that function here:

If you don't have any outputs, you can use a snippet of Visual Basic code without being a programmer:

  1. Press Alt-F11 to open the Visual Basic Editor, then F7 to open the code window.

  2. Paste this VBA code into the window:

    Sub StoreSeed()
        Risk.Simulation.Settings.RandomSeed = _
    End Sub
  3. Please see Setting References in Visual Basic for the necessary references and how to set them.

  4. Click somewhere in the middle of the StoreSeed routine, and press F5 to run the code. This will change @RISK's Simulation Settings, on the Sampling tab, to a fixed random seed. and it will insert the actual seed from the latest simulation as the seed for future simulations.

  5. If you leave the code in place, Excel 2007 or above will no longer store the workbook as an .XLSX but instead will use .XLSM format. This may present you or anyone who opens your workbook with a macro security prompt. To prevent that, you can delete the pasted code before you save the workbook. The fixed random seed will remain in Simulation Settings.

  6. Save the workbook to save the fixed random seed.

See also: Random Number Generation, Seed Values, and Reproducibility

Last edited: 2020-12-03

This page was: Helpful | Not Helpful