Update passwordGenerator loop start index
This commit is contained in:
parent
b22d5baacc
commit
25cf3f103f
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user