Skip to content

Commit

Permalink
First class callable syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Aug 9, 2023
1 parent f43d8e1 commit 12eaa7c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/BigInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ public static function randomBits(int $numBits, ?callable $randomBytesGenerator
}

if ($randomBytesGenerator === null) {
$randomBytesGenerator = 'random_bytes';
$randomBytesGenerator = random_bytes(...);
}

/** @var int<1, max> $byteLength */
$byteLength = \intdiv($numBits - 1, 8) + 1;

$extraBits = ($byteLength * 8 - $numBits);
Expand Down

0 comments on commit 12eaa7c

Please sign in to comment.