You&#x27;re right. Calling RtlGenRandom() directly is probably the best option. I forgot that rand_s() calls RtlGenRandom(), not CryptGenRandom(). Plus both Firefox and Chrome ran into rare crashes when some bad third-party software (antivirus or malware) injects advapi32.dll hooks, causing rand_s() to crash when it tries to load advapi32.dll in order to call RtlGenRandom().<p>Firefox bugs: <a href="https:&#x2F;&#x2F;bugzil.la&#x2F;1240589" rel="nofollow">https:&#x2F;&#x2F;bugzil.la&#x2F;1240589</a>, <a href="https:&#x2F;&#x2F;bugzil.la&#x2F;1167248" rel="nofollow">https:&#x2F;&#x2F;bugzil.la&#x2F;1167248</a>, <a href="https:&#x2F;&#x2F;bugzil.la&#x2F;694344" rel="nofollow">https:&#x2F;&#x2F;bugzil.la&#x2F;694344</a><p>Chrome bug: <a href="https:&#x2F;&#x2F;crbug.com&#x2F;348400" rel="nofollow">https:&#x2F;&#x2F;crbug.com&#x2F;348400</a>