Example #1
0
 public function testIntervalRandom()
 {
     for ($i = 0; $i < 10; $i++) {
         $rnd = CMathf::intervalRandom(12.0, 34.0);
         $this->assertTrue(12.0 <= $rnd && $rnd < 34.0);
     }
     for ($i = 0; $i < 10; $i++) {
         $rnd = CMathf::intervalRandom(56.0, 78.0);
         $this->assertTrue(56.0 <= $rnd && $rnd < 78.0);
     }
     $rnd = CMathf::intervalRandom(0, 0);
     $this->assertTrue($rnd === 0.0);
 }