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
for (let i = 4; i < length; i++) {
for (let i = 3; i < length; i++) {
password += characterSet.charAt(
Math.floor(Math.random() * characterSet.length)
)
@ -49,9 +49,7 @@ export function passwordGenerator(length = 8) {
// Shuffle the password
password = password
.split('')
.sort(function () {
return 0.5 - Math.random()
})
.sort(() => 0.5 - Math.random())
.join('')
return password