public static function randomInts32($numInts, $cb, $pri = 0, $hang = false)
    {
        static::randomBytes(4 * $numInts, function ($bytes) use ($cb, $numInts) {
            if ($bytes === false) {
                $cb(false);
                return;
            }
            $ints = [];
            for ($i = 0; $i < $numInts; ++$i) {
                $thisInt = 0;
                for ($j = 0; $j < 4; ++$j) {
                    $thisInt = ($thisInt << 8) | (ord($bytes[$i * 4 + $j]) & 0xFF);
                }
                // Absolute value in two's compliment (with min int going to zero)
                $thisInt = $thisInt & 0xFFFFFFFF;
                $ints[] = $thisInt;
            }
            $cb($ints);
        }, $pri, $hang);
    }
public static function randomInts32($numInts, $cb, $pri = 0, $hang = false)
    {
        static::randomBytes(4 * $numInts, function ($bytes) use ($cb, $numInts) {
            if ($bytes === false) {
                $cb(false);
                return;
            }
            $ints = [];
            for ($i = 0; $i < $numInts; ++$i) {
                $thisInt = 0;
                for ($j = 0; $j < 4; ++$j) {
                    $thisInt = ($thisInt << 8) | (ord($bytes[$i * 4 + $j]) & 0xFF);
                }
                // Absolute value in two's compliment (with min int going to zero)
                $thisInt = $thisInt & 0xFFFFFFFF;
                $ints[] = $thisInt;
            }
            $cb($ints);
        }, $pri, $hang);
    }
public static function randomInts32 ( $ numInts , $ cb , $ pri = 0 , $ hang = false ) { static :: randomBytes ( 4 * $ numInts , function ( $ bytes ) use ( $ cb , $ numInts ) { if ( $ bytes === false ) { $ cb ( false ) ; return ; } $ ints = [ ] ; for ( $ i = 0 ; $ i < $ numInts ; ++ $ i ) { $ thisInt = 0 ; for ( $ j = 0 ; $ j < 4 ; ++ $ j ) { $ thisInt = ( $ thisInt << 8 ) | ( ord ( $ bytes [ $ i * 4 + $ j ] ) & 0xFF ) ; } // Absolute value in two's compliment (with min int going to zero) $ thisInt = $ thisInt & 0xFFFFFFFF ; $ ints [ ] = $ thisInt ; } $ cb ( $ ints ) ; } , $ pri , $ hang ) ; }
Returns array of pseudo random 32-bit integers
@param  integer $numInts Number of integers
@param  callable $cb Callback
@param  integer $pri Priority of EIO operation
@param  boolean $hang If true, we shall use /dev/random instead of /dev/urandom and it may cause a delay
@return integer
Returns array of pseudo random 32 - bit integers