Chris@0: GetRandom($bytes, 0)); Chris@0: if (RandomCompat_strlen($buf) >= $bytes) { Chris@0: /** Chris@0: * Return our random entropy buffer here: Chris@0: */ Chris@16: return (string) RandomCompat_substr($buf, 0, $bytes); Chris@0: } Chris@0: ++$execCount; Chris@0: } while ($execCount < $bytes); Chris@0: Chris@0: /** Chris@0: * If we reach here, PHP has failed us. Chris@0: */ Chris@0: throw new Exception( Chris@0: 'Could not gather sufficient random data' Chris@0: ); Chris@0: } Chris@17: }