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;
    }