@@ -1416,18 +1416,33 @@ let b = UInt8['0':'9';'A':'Z';'a':'z']
14161416 randstring (r:: AbstractRNG , n:: Int ) = randstring (r, b, n)
14171417 randstring (chars:: AbstractArray{<:Union{UInt8,Char}} = b, n:: Int = 8 ) = randstring (GLOBAL_RNG, chars, n)
14181418 randstring (n:: Int ) = randstring (GLOBAL_RNG, b, n)
1419+
1420+ rand (rng:: AbstractRNG , :: Type{String} , chars:: AbstractArray{<:Union{UInt8,Char}} = b, n:: Int = 8 ) =
1421+ randstring (rng, chars, n)
1422+ rand (rng:: AbstractRNG , :: Type{String} , n:: Int ) = randstring (rng, b, n)
1423+ rand (:: Type{String} , chars:: AbstractArray{<:Union{UInt8,Char}} = b, n:: Int = 8 ) =
1424+ randstring (GLOBAL_RNG, chars, n)
1425+ rand (:: Type{String} , n:: Int ) = randstring (GLOBAL_RNG, b, n)
14191426end
14201427
14211428"""
14221429 randstring([rng=GLOBAL_RNG], [chars::AbstractArray{<:Union{UInt8,Char}}], [len=8])
14231430
1424- Create a random ASCII string of length `len`, consisting of characters
1431+ Create a random string of length `len`, consisting of characters
14251432from `chars` if specified, and of upper- and lower-case letters and
14261433the digits 0-9 otherwise. The optional `rng` argument specifies a
14271434random number generator, see [Random Numbers](@ref).
14281435"""
14291436randstring
14301437
1438+ """
1439+ rand([rng=GLOBAL_RNG], ::Type{String}, [chars::AbstractArray{<:Union{UInt8,Char}}], [len=8])
1440+
1441+ Create a random string of length `len`, consisting of characters
1442+ from `chars` if specified, and of upper- and lower-case letters and
1443+ the digits 0-9 otherwise. Equivalent to [`randstring`](@ref)`(rng, chars, len)`.
1444+ """
1445+
14311446# Fill S (resized as needed) with a random subsequence of A, where
14321447# each element of A is included in S with independent probability p.
14331448# (Note that this is different from the problem of finding a random
0 commit comments