Skip to content

Instantly share code, notes, and snippets.

@rossmurray
Last active December 17, 2015 16:49
Show Gist options
  • Save rossmurray/5641341 to your computer and use it in GitHub Desktop.
Save rossmurray/5641341 to your computer and use it in GitHub Desktop.
convert random bytes to uint
using(var rng = new RNGCryptoServiceProvider())
{
var bytes = new byte[4];
rng.GetBytes(bytes);
var value = BitConverter.ToUInt32(bytes, 0);
value.Dump();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment