Skip to contents

rstring() makes a string that is statically extremely likely to be unique (using default options).

Usage

rstring(n, x = 12, filesafe = TRUE)

Arguments

n

Numeric integer: How many strings to make (default is 1).

x

Numeric integer: Number of letters and digits to use to make the string. Default is 12, leading to a probability of two matching random strings of <3.7E-18 if filesafe = TRUE and <3.1E-22 if FALSE.

filesafe

Logical: If TRUE (default), make file-safe names (leading character is a letter).

Value

Character.

Examples


rstring(1)
#> [1] "Rds3Z4qwECZ3"
rstring(5)
#> [1] "jisyYUCWowK4" "xZE6kU1N7gYB" "iNlcphl3bgrz" "y7G0zbi4QGpw" "j7oQFtAa74y8"
rstring(5, 3)
#> [1] "j7X" "Q59" "EH5" "ZPX" "UKs"