RandomState

Set random number generator

Description

The RandomState property sets the random number generator for the stochastic solvers. It is a property of the SolverOptions object. SolverOptions is a property of the configset object.

SimBiology® software uses a pseudorandom number generator. The sequence of numbers generated is determined by the state of the generator, which can be specified by the integer RandomState. If RandomState is set to integer J, the random number generator is initialized to its Jth state. The random number generator can generate all the floating-point numbers in the closed interval [2^(-53), 1-2^(-53)]. Theoretically, it can generate over 2^1492 values before repeating itself. But for a given state, the sequence of numbers generated will be the same. To change the sequence, change RandomState. SimBiology software resets the state at startup. The default value of RandomState is [].

Characteristics

Applies toObjects: SolverOptions for SSA, expltau, impltau
Data typeint
Data valuesDefault is [] (empty).
AccessRead/write

Examples

This example shows how to change RandomState settings.

  1. Retrieve the configset object from the modelObj and change the SolverType to expltau.

    modelObj  = sbiomodel('cell');
    configsetObj = getconfigset(modelObj);
    set(configsetObj, 'SolverType', 'expltau')
  2. Change the Randomstate to 5.

    set(configsetObj.SolverOptions, 'RandomState', 5);
    get(configsetObj.SolverOptions, 'RandomState'))
    
    
    ans =
    
      5
Was this topic helpful?