If you want to create strings rather than vectors of string/char, you may want to use randstring
from the Random
stdlib. Normally, it’s also cleaner to represent characters as Char
s, rather than as unit-length String
s:
using Random: randstring
alphabet = ['i', 'a', 'p', 't'] # single quotes
jl> randstring(alphabet, 7)
"pttiitp"
(If your alphabet is short, you could even use a tuple, alphabet = ('i', 'a', 'p', 't')
, for extra performance )