- MathAbs
- MathArccos
- MathArcsin
- MathArctan
- MathArctan2
- MathClassify
- MathCeil
- MathCos
- MathExp
- MathFloor
- MathLog
- MathLog10
- MathMax
- MathMin
- MathMod
- MathPow
- MathRand
- MathRound
- MathSin
- MathSqrt
- MathSrand
- MathTan
- MathIsValidNumber
- MathExpm1
- MathLog1p
- MathArccosh
- MathArcsinh
- MathArctanh
- MathCosh
- MathSinh
- MathTanh
- MathSwap
MathSrand
Sets the starting point for generating a series of pseudorandom integers.
void MathSrand(
|
Parameters
seed
[in] Starting number for the sequence of random numbers.
Return Value
No return value.
Note
The MathRand() function is used for generating a sequence of pseudorandom numbers. Call of MathSrand() with a certain initializing number allows to always produces the same sequence of pseudorandom numbers.
To ensure receipt of non-recurring sequence, use the call of MathSrand(GetTickCount()), since the value of GetTickCount() increases from the moment of the start of the operating system and is not repeated within 49 days, until the built-in counter of milliseconds overflows. Use of MathSrand(TimeCurrent()) is not suitable, because the TimeCurrent() function returns the time of the last tick, which can be unchanged for a long time, for example at the weekend.
Initialization of the random number generator using MathSrand() for indicators and Expert Advisors is better performed in the OnInit() handler; it saves you from the following multiple restarts of the generator in OnTick() and OnCalculate().
Instead of the MathSrand() function you can use the srand() function.
Example:
#property description "The indicator shows the central limit theorem, which states:"
|