I was looking at string functions in the Julia documentation window in Atom and it mentioned randstring(). So I tried it and Julia says it doesn’t exist. In fact a lot or string functions it mentioned don’t seem to be there:
ERROR: UndefVarError: randstring not defined
It is even cited online as per below. What gives? Why are functions in the docs not there?
julia> randstring
ERROR: UndefVarError: randstring not defined
julia> using Random
julia> randstring
randstring (generic function with 8 methods)
help?> randstring
search: randstring
randstring([rng=GLOBAL_RNG], [chars], [len=8])
Create a random string of length len, consisting of characters from chars, which defaults to the set of upper- and lower-case letters
and the digits 0-9. The optional rng argument specifies a random number generator, see Random Numbers.
Examples
≡≡≡≡≡≡≡≡≡≡
julia> Random.seed!(3); randstring()
"Y7m62wOj"
julia> randstring(MersenneTwister(3), 'a':'z', 6)
"ocucay"
julia> randstring("ACGT")
"ATTTGCGT"
│ Note
│
│ chars can be any collection of characters, of type Char or UInt8 (more efficient), provided rand can randomly pick characters
│ from it.