Created
September 20, 2018 03:32
-
-
Save haroldcris/951a588d87ea34e84adc9e973e5c2ba5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| private static string GenerateRandomOtp(int iOTPLength) | |
| { | |
| string[] saAllowedCharacters = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; | |
| string sOTP = String.Empty; | |
| string sTempChars = String.Empty; | |
| Random rand = new Random(); | |
| for (int i = 0; i < iOTPLength; i++) | |
| { | |
| int p = rand.Next(0, saAllowedCharacters.Length); | |
| sTempChars = saAllowedCharacters[rand.Next(0, saAllowedCharacters.Length)]; | |
| sOTP += sTempChars; | |
| } | |
| return sOTP; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment