title: RtlGenRandom/CryptGenRandom or other WinAPI to generate cryptographically secure random numbers (first quarter of 2018)
body: <p>I swear, this seems to be changing every time I check the MSDN documentation. When I coded my executable Microsoft was suggesting to use <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx" rel="nofollow noreferrer">RtlGenRandom</a> API to generate cryptographically strong random numbers.</p>
  
  <p>Now when I'm checking documentation for RtlGenRandom, the note there suggests using <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa379942(v=vs.85).aspx" rel="nofollow noreferrer">CryptGenRandom</a> instead. But then another note for CryptGenRandom states this:</p>
  
  <blockquote>
    <p>Important:  This API is deprecated. New and existing software should
    start using <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa376210(v=vs.85).aspx" rel="nofollow noreferrer">Cryptography Next Generation APIs</a>. Microsoft may remove
    this API in future releases.</p>
  </blockquote>
  
  <p>So can someone show an example in C of how to use those  "<em>Cryptography Next Generation APIs</em>" to generate a byte array of random numbers that Microsoft recommends now?</p>