#' Generate a password from random characters
#' @param length Length of the Password; integer
#' @return password with the size of `length` argument
#' @export
gen_passwd <- function(length = 16L) {
if (is.null(length)) {
length <- 16L
}
if (!isTRUE(is.numeric(length))) {
length <- 16L
}
char_vector <- c(
LETTERS,
letters,
0:9,
"!", ",", ".", "|", "@", "#", "$", "%", "&", "*"
)
paste0(
sample(x = char_vector, size = length, replace = TRUE),
collapse = ""
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.