Created
May 22, 2014 19:25
-
-
Save ADelRosarioH/9219f619e79c3ded170a to your computer and use it in GitHub Desktop.
Generate random digits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string digits() | |
{ | |
var bytes = new byte[4]; | |
var rng = RandomNumberGenerator.Create(); | |
rng.GetBytes(bytes); | |
uint random = BitConverter.ToUInt32(bytes, 0) % 100000000; | |
return String.Format("{0:D8}", random); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment