Update passwordGenerator loop start index

This commit is contained in:
Douglas Barone 2024-01-30 07:57:40 -04:00
parent b22d5baacc
commit 25cf3f103f

View File

@ -40,7 +40,7 @@ export function passwordGenerator(length = 8) {
// ) // )
// Add random characters to the password until it reaches the desired length // Add random characters to the password until it reaches the desired length
for (let i = 4; i < length; i++) { for (let i = 3; i < length; i++) {
password += characterSet.charAt( password += characterSet.charAt(
Math.floor(Math.random() * characterSet.length) Math.floor(Math.random() * characterSet.length)
) )
@ -49,9 +49,7 @@ export function passwordGenerator(length = 8) {
// Shuffle the password // Shuffle the password
password = password password = password
.split('') .split('')
.sort(function () { .sort(() => 0.5 - Math.random())
return 0.5 - Math.random()
})
.join('') .join('')
return password return password