--TEST-- Random: Randomizer: Heavily biased engines are detected and rejected --FILE-- getInt(0, 1234)); } catch (Random\BrokenRandomEngineError $e) { echo $e->getMessage(), PHP_EOL; } try { var_dump(randomizer()->nextInt()); } catch (Random\BrokenRandomEngineError $e) { echo $e->getMessage(), PHP_EOL; } try { var_dump(bin2hex(randomizer()->getBytes(1))); } catch (Random\BrokenRandomEngineError $e) { echo $e->getMessage(), PHP_EOL; } try { var_dump(randomizer()->shuffleArray(range(1, 1234))); } catch (Random\BrokenRandomEngineError $e) { echo $e->getMessage(), PHP_EOL; } try { var_dump(randomizer()->pickArrayKeys(range(1, 1234), 1)); } catch (Random\BrokenRandomEngineError $e) { echo $e->getMessage(), PHP_EOL; } try { var_dump(randomizer()->pickArrayKeys(range(1, 1234), 10)); } catch (Random\BrokenRandomEngineError $e) { echo $e->getMessage(), PHP_EOL; } try { var_dump(randomizer()->shuffleBytes('foobar')); } catch (Random\BrokenRandomEngineError $e) { echo $e->getMessage(), PHP_EOL; } ?> --EXPECTF-- Failed to generate an acceptable random number in 50 attempts int(%d) string(2) "ff" Failed to generate an acceptable random number in 50 attempts Failed to generate an acceptable random number in 50 attempts Failed to generate an acceptable random number in 50 attempts Failed to generate an acceptable random number in 50 attempts