password generator is faulty
hi i used a password generator from a website flashkit.com, the code is as follows, but kicks out different variable ranging from 1 then 2 then 3 then 1 and is not constantly kicking out seven , can someone help me to change it please.
function newPassword(){
var totalChar = 7; // number of chars in the password
var salt = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789"; // salt to select chars from
var saltLength=salt.length;
var userPass=""; // set the inital variable
for (var xx=0;xx<totalChar;xx++){ // loop and create password
userPass+=salt.charAt(Math.floor(Math.random()*saltLength));
}
return userPass;
}
button1.onRelease=function(){
fred.text=newPassword();
}
