You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the Drawing Random Floating-Point Numbers from an Interval. Frédéric Goualard, ACM Trans. Model. Comput. Simul., 32:3, 2022. https://doi.org/10.1145/3503512 paper, the $min + rand() / randmax() * ($max - $min) construction of Base::randomFloat()
Return values that are biased towards specific subintervals.
This is unfixable in userland. The only solution is to leverage PHP 8.3's Randomizer::getFloat() which will do the right thing. See the https://wiki.php.net/rfc/randomizer_additions RFC for additional details.
The text was updated successfully, but these errors were encountered:
Summary
As per the Drawing Random Floating-Point Numbers from an Interval. Frédéric Goualard, ACM Trans. Model. Comput. Simul., 32:3, 2022. https://doi.org/10.1145/3503512 paper, the
$min + rand() / randmax() * ($max - $min)
construction ofBase::randomFloat()
https://github.com/FakerPHP/Faker/blob/2.0/src/Faker/Provider/Base.php#L111-L132
is unsafe and depending on the inputs might:
This is unfixable in userland. The only solution is to leverage PHP 8.3's Randomizer::getFloat() which will do the right thing. See the https://wiki.php.net/rfc/randomizer_additions RFC for additional details.
The text was updated successfully, but these errors were encountered: