'random_bytes(): $bytes must be an integer'
);
}
+
if ($bytes < 1) {
throw new Error(
'Length must be greater than 0'
);
}
+
$buf = '';
$util = new COM('CAPICOM.Utilities.1');
$execCount = 0;
+
/**
* Let's not let it loop forever. If we run N times and fail to
* get N bytes of random data, then CAPICOM has failed us.
}
++$execCount;
} while ($execCount < $bytes);
+
/**
* If we reach here, PHP has failed us.
*/