R/utils-random-password.R
random_password.Rd
This function generates a random passord sampled from the ASCII table.
random_password(length = 12, replace = FALSE, extended = TRUE)
length of the password
sample from the ASCII table with (TRUE
) or without
(FALSE
) replacement?
if FALSE
, use alphanumeric characters only; otherwise
use all the ASCII characters
a character string
random_password()
#> [1] "Ui&hntDxAKz@"
# set the seed to get fixed password every time; you may just remember the
# seed and forget the real password because it's reproducible
set.seed(123)
random_password()
#> [1] ">nR-bIQJ{8dX"
# long password
random_password(20, TRUE)
#> [1] "{(|g9&I(rCmpJk.?&(Hi"