mardi 4 juin 2019

How to generate random alphanumeric string in julia?

I am trying to generate 12 characters alphanumeric string in julia with the following snippets:
a)
an = randstring(rand(Bool) ? ('A':'Z') : ('0':'9'), 12)
b)

an = "" 
for i in [1:12]
    an *= randstring(rand(Bool) ? ('A':'Z') : ('0':'9'))
end

but both gives either complete 12 digits or 12 alphabets but not of their combination.

please guide me in generating combination of 12 alphanumeric string.




Aucun commentaire:

Enregistrer un commentaire