Files
mql5-skills/skills/mql5/references/docs/03-predefined/0212-predefined-randomseed.md
T
2026-06-23 21:47:51 +08:00

563 B

_RandomSeed

Variable for storing the current state when generating pseudo-random integers. _RandomSeed changes its value when calling MathRand(). Use MathSrand() to set the required initial condition.

x random number received by MathRand() function is calculated in the following way at each call:

x=_RandomSeed*214013+2531011;
_RandomSeed=x;
x=(x>>16)&0x7FFF;

See also

MathRand(), MathSrand(), Integer types