diff --git a/src/dict/order.php b/src/dict/order.php index 104bd39c..329c2206 100644 --- a/src/dict/order.php +++ b/src/dict/order.php @@ -38,10 +38,9 @@ function reverse( * Time complexity: O(n) * Space complexity: O(n) */ -<<__NonRx('Randomness')>> function shuffle( KeyedTraversable $container, -): dict { +)[defaults]: dict { $dict = cast_clear_legacy_array_mark($container); return Vec\keys($container) |> Vec\shuffle($$) diff --git a/src/random/pseudo.php b/src/random/pseudo.php index 42fe8fb7..989d8c04 100644 --- a/src/random/pseudo.php +++ b/src/random/pseudo.php @@ -18,8 +18,7 @@ * * For secure random floats, see `SecureRandom\float`. */ -<<__NonRx('Randomness')>> -function float(): float { +function float()[defaults]: float { return (float)(namespace\int(0, Math\INT53_MAX - 1) / Math\INT53_MAX); } @@ -29,11 +28,10 @@ function float(): float { * * For secure random integers, see `SecureRandom\int`. */ -<<__NonRx('Randomness')>> function int( int $min = \PHP_INT_MIN, int $max = \PHP_INT_MAX, -): int { +)[defaults]: int { invariant( $min <= $max, 'Expected $min (%d) to be less than or equal to $max (%d).', @@ -50,11 +48,10 @@ function int( * * For secure random strings, see `SecureRandom\string`. */ -<<__NonRx('Randomness')>> function string( int $length, ?string $alphabet = null, -): string { +)[defaults]: string { // This is a temporary alias. You should never, ever depend on this function // being cryptographically secure. return SecureRandom\string($length, $alphabet); diff --git a/src/random/secure.php b/src/random/secure.php index 48166cd3..b78c8e0c 100644 --- a/src/random/secure.php +++ b/src/random/secure.php @@ -18,8 +18,7 @@ * * For pseudorandom floats, see `PseudoRandom\float`. */ -<<__NonRx('Randomness')>> -function float(): float { +function float()[defaults]: float { return (float)(namespace\int(0, Math\INT53_MAX - 1) / Math\INT53_MAX); } @@ -29,11 +28,10 @@ function float(): float { * * For pseudorandom integers, see `PseudoRandom\int`. */ -<<__NonRx('Randomness')>> function int( int $min = \PHP_INT_MIN, int $max = \PHP_INT_MAX, -): int { +)[defaults]: int { invariant( $min <= $max, 'Expected $min (%d) to be less than or equal to $max (%d).', @@ -49,11 +47,10 @@ function int( * * For pseudorandom strings, see `PseudoRandom\string`. */ -<<__NonRx('Randomness')>> function string( int $length, ?string $alphabet = null, -): string { +)[defaults]: string { return _Private\random_string( /* HH_FIXME[2049] calling stdlib directly */ /* HH_FIXME[4107] calling stdlib directly */ diff --git a/src/vec/order.php b/src/vec/order.php index 29288217..1c5752f9 100644 --- a/src/vec/order.php +++ b/src/vec/order.php @@ -66,10 +66,9 @@ function reverse( * Time complexity: O(n) * Space complexity: O(n) */ -<<__NonRx('Randomness')>> function shuffle( Traversable $traversable, -): vec { +)[defaults]: vec { $vec = cast_clear_legacy_array_mark($traversable); /* HH_FIXME[2049] calling stdlib directly */ /* HH_FIXME[4107] calling stdlib directly */