public static function randomBytes($len, $cb, $pri = 0, $hang = false)
    {
        $cb = CallbackWrapper::wrap($cb);
        FileSystem::open('/dev/' . ($hang ? '' : 'u') . 'random', 'r', function ($file) use ($len, $cb, $pri) {
            if (!$file) {
                $cb(false);
                return;
            }
            $file->read($len, 0, function ($file, $data) use ($cb) {
                $cb($data);
            }, $pri);
        }, null, $pri);
    }
public static function randomBytes($len, $cb, $pri = 0, $hang = false)
    {
        $cb = CallbackWrapper::wrap($cb);
        FileSystem::open('/dev/' . ($hang ? '' : 'u') . 'random', 'r', function ($file) use ($len, $cb, $pri) {
            if (!$file) {
                $cb(false);
                return;
            }
            $file->read($len, 0, function ($file, $data) use ($cb) {
                $cb($data);
            }, $pri);
        }, null, $pri);
    }
public static function randomBytes ( $ len , $ cb , $ pri = 0 , $ hang = false ) { $ cb = CallbackWrapper :: wrap ( $ cb ) ; FileSystem :: open ( '/dev/' . ( $ hang ? '' : 'u' ) . 'random' , 'r' , function ( $ file ) use ( $ len , $ cb , $ pri ) { if ( ! $ file ) { $ cb ( false ) ; return ; } $ file -> read ( $ len , 0 , function ( $ file , $ data ) use ( $ cb ) { $ cb ( $ data ) ; } , $ pri ) ; } , null , $ pri ) ; }
Returns string of pseudo random bytes
@param  integer $len Length of desired string
@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 string of pseudo random bytes