Creating a Random Password Generator

If you're using passwords of any type on your site, it is best to keep them random. That way they cannot be easily guessed at by intruders.

First, it's good to know a little about ASCII characters. Every character your keyboard can type is actually represented by a number. So the letter A is represented by 65. The letter Z is represented by 90. So all you need to do is generate a series of random numbers, each number between 65 and 90. That would give you a way to find the equivalent letters.

If you want to include numbers too, those are found between spots 48 and 57. I wouldn't use the spots between 57 and 65 - those are odd characters like colons.

So let's say you want to create a 7 character password that contains a random assortment of letters and numbers. You could do something like this:

So you just keep generating a new ASCII character, and each time you do, you see if it's in either the letter or number range. If it is, you use it to add to your password. If it isn't (i.e. if it is in that 'symbol' middle area) you ignore it and keep looking. When you are done, you should have a nice, random password!