code: public function getBoolean($probability = 0.5)
      {
          if ((\is_int($probability) || \is_float($probability)) === false
                  || $probability < 0
                  || $probability > 1
          ) {
              throw new InvalidArgumentException('Invalid probability');
          }
  
          if ($probability == 0) {
              $result = false;
          } else {
              $random = $this->generator->getFloat(0, 1);
              $result = ($probability >= $random);
          }
  
          return $result;
      }
docs: Returns random boolean using given probability of "true".
  
  @param float $probability Probability of result "true".
  Must be between 0 and 1.
  Defaults to 0.5.
  
  @return boolean
  
  @throws InvalidArgumentException for invalid probability.