Skip to content

Commit

Permalink
Merge pull request #116 from giorgiosironi/php_7.2
Browse files Browse the repository at this point in the history
Enable PHP 7.2 build
  • Loading branch information
giorgiosironi committed Aug 5, 2018
2 parents d921bbe + ffca6a2 commit 7287aa9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ matrix:
env: WITH_CS=true
- php: 7 # PHPUnit 6.x
- php: 7.1 # PHPUnit 7.x
- php: 7.2 # PHPUnit 7.x
- php: hhvm
env: SKIP_LINT_TEST_CASES=1
sudo: required
Expand Down
18 changes: 9 additions & 9 deletions src/Random/MersenneTwister.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,27 @@ public function seed($seed)
$this->mt[$i] = ($this->f * (
$this->mt[$i - 1] ^ (($this->mt[$i - 1] >> ($this->w - 2)) & 0b11)
) + $i) & $this->wMask;
assert('$this->mt[$i] <= $this->wMask');
assert($this->mt[$i] <= $this->wMask);
}
assert('count($this->mt) === 624');
assert(count($this->mt) === 624);
return $this;
}

public function extractNumber()
{
assert('$this->index <= $this->n');
assert($this->index <= $this->n);
if ($this->index >= $this->n) {
$this->twist();
}
$y = $this->mt[$this->index];
$y = $y ^ (($y >> $this->u) & $this->d);
assert('$y <= 0xffffffff');
assert($y <= 0xffffffff);
$y = $y ^ (($y << $this->s) & $this->b);
assert('$y <= 0xffffffff');
assert($y <= 0xffffffff);
$y = $y ^ (($y << $this->t) & $this->c);
assert('$y <= 0xffffffff');
assert($y <= 0xffffffff);
$y = $y ^ ($y >> $this->l);
assert('$y <= 0xffffffff');
assert($y <= 0xffffffff);
$this->index = $this->index + 1;
return $y & $this->wMask;
}
Expand All @@ -78,9 +78,9 @@ 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');
assert($x <= 0xffffffff);
$xA = $x >> 1;
assert('$xA <= 0x7fffffff');
assert($xA <= 0x7fffffff);
if (($x % 2) != 0) {
$xA = $xA ^ $this->a;
}
Expand Down

0 comments on commit 7287aa9

Please sign in to comment.