Random Password Function

This script can be used to generate random passwords for improved password strength.

Example

Length:

Password:

 

Source Code

This is the function used to generate the random passwords, it takes the required password length as an argument and returns a random password string.

<script>
function randomPassword(length)
{
   chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
   pass = "";

   for(x=0;x<length;x++)
   {
      i = Math.floor(Math.random() * 62);
      pass += chars.charAt(i);
   }

   return pass;
}
</script>

Download Password Generator