random_compat

From: Date: Wed, 08 Jul 2015 09:59:05 +0000
Subject: random_compat
Groups: php.internals 
Request: Send a blank email to internals+get-87069@lists.php.net to get a copy of this message
Hi everyone, I'm working on a library to backport random_bytes() and random_int() into PHP 5. The effort is located on Github if anyone is interested: https://github.com/paragonie/random_compat My reason for this email is that I'm running into one compatibility issue that I don't think I can safely work around: If we let random_int() default to -PHP_INT_MAX and PHP_INT_MAX, then the difference between the two (used to calculate the range) will overflow into a float, which will lead to a loss of precision. My current compromise is to use -(PHP_INT_MAX/2) and PHP_INT_MAX/2, but I'm not sure if there's a better solution. Scott Arciszewski Chief Development Officer Paragon Initiative Enterprises <https://paragonie.com>

« previous php.internals (#87069) next »