randomString
Call Signature
Section titled “Call Signature”randomString(
length,exists?):string
Defined in: src/util/RandomString.ts:78
length characters drawn uniformly from the enabled character classes.
Always returns exactly length characters — see fromAlphabet for what
makes that a guarantee rather than a best effort. Throws if length is not a
non-negative integer, or if every class is disabled: an empty alphabet has
nothing to draw from, and failing loudly beats a call that never returns.
exists draws again while it answers true — see ExistsPredicate. It
takes this slot when the character classes are left at their defaults and the
one after options when they are not; two overloads rather than one third
parameter, so that randomString(8, exists) needs no {} placeholder to
reach it.
Parameters
Section titled “Parameters”length
Section titled “length”number
exists?
Section titled “exists?”Returns
Section titled “Returns”string
Call Signature
Section titled “Call Signature”randomString(
length,options,exists?):string
Defined in: src/util/RandomString.ts:83
length characters from the classes options enables, drawing again while
exists answers true. Both arguments are documented on the overload above.
Parameters
Section titled “Parameters”length
Section titled “length”number
options
Section titled “options”exists?
Section titled “exists?”Returns
Section titled “Returns”string
