The implementation sticks to the JavaScript specificiation including EcmaScript 6 proposals.
See https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math for a documentation and
specification of the JavaScript implementation.
/** * @test */ public function randomIntReturnsARandomResultFromMinToMaxExclusive() { $helper = new MathHelper(); $min = 10; $max = 42; $r1 = $helper->randomInt($min, $max); $atLeastOneRandomResult = false; for ($i = 0; $i < 100; $i++) { $ri = $helper->randomInt($min, $max); if ($ri !== $r1) { $atLeastOneRandomResult = true; } $this->assertLessThanOrEqual($max, $ri); $this->assertGreaterThanOrEqual($min, $ri); } $this->assertTrue($atLeastOneRandomResult, 'random() should return a random result'); }