Assume that getmypid() never returns false

my background research on this informs me that this returns false on negative PID, which never happens because the underlying C API call never fails - not on linux, bsd, or windows.
This commit is contained in:
Dylan K. Taylor 2020-02-05 21:00:56 +00:00
parent 037c34d961
commit 34972c3327

View File

@ -123,7 +123,7 @@ final class RuntimeBlockMapping{
*/
private static function randomizeTable(array $table) : array{
$postSeed = mt_rand(); //save a seed to set afterwards, to avoid poor quality randoms
mt_srand(getmypid() ?: 0); //Use a seed which is the same on all threads. This isn't a secure seed, but we don't care.
mt_srand(getmypid()); //Use a seed which is the same on all threads. This isn't a secure seed, but we don't care.
shuffle($table);
mt_srand($postSeed); //restore a good quality seed that isn't dependent on PID
return $table;