mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
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:
parent
037c34d961
commit
34972c3327
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user