Set random number generator
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 []
.
Applies to | Objects: SolverOptions for SSA,
expltau, impltau |
Data type | int |
Data values | Default is [] (empty). |
Access | Read/write |
This example shows how to change RandomState
settings.
Retrieve the configset
object from
the modelObj
and change the SolverType
to expltau
.
modelObj = sbiomodel('cell'); configsetObj = getconfigset(modelObj); set(configsetObj, 'SolverType', 'expltau')
Change the Randomstate
to 5
.
set(configsetObj.SolverOptions, 'RandomState', 5); get(configsetObj.SolverOptions, 'RandomState')) ans = 5