private function twist()
{
for ($i = 0; $i <= $this->n - 1; $i++) {
$x = ($this->mt[$i] & $this->upperMask) + ($this->mt[($i + 1) % $this->n] & $this->lowerMask);
assert('$x <= 0xffffffff');
$xA = $x >> 1;
assert('$xA <= 0x7fffffff');
if ($x % 2 != 0) {
$xA = $xA ^ $this->a;
}
$this->mt[$i] = $this->mt[($i + $this->m) % $this->n] ^ $xA;
}
$this->index = 0;
}