Generates a random password.
The result is generated using the cryptographically secure random number generator.
Includes letters (ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz), and if the length is greater than 4, at least one digit (0123456789) and a special character (*@.-!_%+).
After evaluation, the codebook is saved to the disk. Therefore, the generated password will also be stored.
password(lengthOrOptions?)
lengthOrOptions optional
If a number, the length of password to generate. Must be greater than zero. If not specified, the result will contain 25 characters.
If an object, must contain the following property:
bits
The minimum number of bits of entropy that the password should contain.
A string containing a random password.
random.password()
"BUR89OvlnG*t%dF6Nmf!p_geQ"
random.password(18)
"t1mI4-QqgqZR7+M6ft"
random.password({ bits: 256 })
"HggNrziEha4LfPrvW9z68kMgfEdpS2hvb!YsBQmMYcaSNb"