title: Create a cryptographically secure random GUID in .NET
body: <p>I want to create a cryptographically secure GUID (v4) in .NET.</p>
  
  <p>.NET's <code>Guid.NewGuid()</code> function is not cryptographically secure, but .NET does provide the <code>System.Security.Cryptography.RNGCryptoServiceProvider</code> class.</p>
  
  <p>I would like to be able to pass a random number function as a delegate to <code>Guid.NewGuid</code> (or even pass some class that provides a generator interface) but it doesn't look as though that is possible with the default implementation.</p>
  
  <p>Can I create a cryptographically secure GUID by using <code>System.GUID</code> and <code>System.Security.Cryptography.RNGCryptoServiceProvider</code> together?</p>