public function __construct($random = false)
 {
     if (!$random instanceof Random) {
         $random = new Random();
     }
     $this->xCoord = $random->nextFloat() * 256;
     $this->yCoord = $random->nextFloat() * 256;
     $this->zCoord = $random->nextFloat() * 256;
     for ($i = 0; $i < 512; ++$i) {
         $this->permutations[$i] = 0;
     }
     for ($i = 0; $i < 256; ++$i) {
         $this->permutations[$i] = $i;
     }
     for ($i = 0; $i < 256; ++$i) {
         $j = $random->nextRange(0, 256 - $i) + $i;
         $k = $this->permutations[$i];
         $this->permutations[$i] = $this->permutations[$j];
         $this->permutations[$j] = $k;
         $this->permutations[$i + 256] = $this->permutations[$i];
     }
 }