Or rand_s(), which wraps CryptGenRandom() with a more convenient API:<p><a href="https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;sxtz2fa8.aspx" rel="nofollow">https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;sxtz2fa8.aspx</a>