Generating a random string with Letters, numbers and special characters

Hi Everyone,

I wanted to generated a random string as a combination of Letters, Numbers and special characters.
I am using below code lines.
generate Random String 12 [LETTERS][NUMBERS]@$!*&%

Sometimes I am getting combination of Letters and Numbers and sometime letters and special characters and rare times a correct password including all.

Can someone help me to get the correct string everytime?

Thanks

Hi Sakshi,

Welcome to the randomness that is random generators, what you are getting is the expected behaviour.

You could run Generate Random String 3 times and concatenate the 3 strings:

Generate Random String 4 @$!*&%
Generate Random String 4 [LETTERS]
Generate Random String 4 [NUMBERS]

But I suspect that Password from FakerLibrary might be a better option for what you want to do, that library has a lot of other useful keywords for generating random data too.

Dave.

1 Like