RealTest User Guide
RealTest User Guide

 

 

Navigation: RealTest Script Language > Syntax Element Details >

RandomSeed

 

 

 

 

Category

Settings

Description

Permits use of the same sequence of pseudo-random numbers every time a script is run; a number, or an expression of Parameters evaluated for each test

Notes

Pseudo-random numbers can be used explicitly by scripts via the Random function and are used implicitly in Optimization (some modes) and Monte Carlo analysis.

If RandomSeed is not specified or is 0 then random numbers are different every time RealTest runs and are selected from a much larger set of possible values (the C runtime library function rand_s is used).

When RandomSeed is specified, the seed is passed to the C srand function and the rand function is then used for each random value needed. Each test seeds its own sequence after its Data items have been calculated (Data items are calculated by several threads, each seeded from RandomSeed plus its thread number, so a Data item that uses Random gets the same values in every test unless the seed itself changes).

A constant RandomSeed is offset by each test's position in an Optimization (0 for the first test), so the tests draw different random values from each other while the run as a whole reproduces exactly when repeated. A single test uses the seed itself.

A RandomSeed that references Parameters is evaluated for each test and used exactly as evaluated, so any test of an optimization can be reproduced on its own by running a single test with that test's parameter values. For example, with a parameter pass that is not used anywhere else, RandomSeed: 1000 + pass * 977 gives each value of pass its own sequence, which a single test with that pass value repeats. This is a convenient way to run a strategy with SetupScore: Random() many times to see the range of results that random selection among tied setups can produce.

It is recommended to not specify a RandomSeed unless you have a particular need for it, as the rand_s function is significantly more robust than rand is.

 

 

 

 

Copyright © 2020-2026 Systematic Solutions, LLC