Randomly generated unique IDs are used throughout the package, created by
rand_names()
. If random strings are required that may not clash with a set
of existing values, this can be guaranteed by passing them as old_names
.
The set of allowed characters can be controlled via chars
and non-random
pre- and suffixes may be specified as prefix
/suffix
arguments, while
uniqueness is guaranteed including pre- and suffixes.
Usage
rand_names(
old_names = character(0L),
n = 1L,
length = 15L,
chars = letters,
prefix = "",
suffix = ""
)
Value
A character vector of length n
where each entry contains length
characters (all among chars
and start/end with prefix
/suffix
), is
guaranteed to be unique and not present among values passed as old_names
.
Examples
rand_names(chars = c(letters, LETTERS, 0:9))
#> [1] "kGJgwxHhiYO68LS"
rand_names(length = 5L)
#> [1] "myucm"
rand_names(n = 5L, prefix = "pre-", suffix = "-suf")
#> [1] "pre-rwtkdbi-suf" "pre-rslsqjl-suf" "pre-mpgudac-suf" "pre-gqflgkj-suf"
#> [5] "pre-hvqltor-suf"