Learn R Programming

fun (version 0.4)

random_password: Generate a random password with a specified length

Description

This function generates a random passord sampled from the ASCII table.

Usage

random_password(length = 12, replace = FALSE, extended = TRUE)

Value

a character string

Arguments

length

length of the password

replace

sample from the ASCII table with (TRUE) or without (FALSE) replacement?

extended

if FALSE, use alphanumeric characters only; otherwise use all the ASCII characters

Author

Yihui Xie <https://yihui.org>

See Also

Examples

Run this code
random_password()
# 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()
# long password
random_password(20, TRUE)

Run the code above in your browser using DataLab