Challenge: You want to make a random password for a password reset feature in C#. You can make a new Guid and just strip out the hyphens, but you've noticed that you cannot just build a string by returning (several times over) a character based upon a random number. The random numbers in C# are based on the ticks and if you call something that generates a random number ten times in a row back to back you will get the same random number ten times over. Another approach:
- Make a Random number using a big range of possible values such as one billion.
- Cast the number to a string.
- Encrypt the string.
No comments:
Post a Comment