Create a String variable with Random Letters and Numbers | Uipath

In projects that require one-time passwords, generating random passwords using letters and numbers is a very handy method.

We’ll examine how we can accomplish this together in this article:
First and foremost, we must establish a string variable containing letters and numbers that will be used to generate a random password.


Following that, we’ll add the characters using the “While” condition. Using the “Assign” activity within the While condition, we’ll generate a Random value and watch how long it lasts.


We’ll call this variable “i” and it’ll be a “integer” variable. The “i” variable will show us how long the Random value is.


We can produce random strings by combining these two variable kinds.
Now, let’s look at how to combine these variables in the following example:


Firstly, **constSTR.Length —**To find out how long the variable we used previously was.

strRandom — When the variable I reaches the value of 9, for example, will return a random integer.

For example StrRandom.Next(strMixChar.Length) — Gave us the number 7 at random.

As a result, strMixChar(7) will return the value “h”.

At each level, various characters are generated using the Random function.

In the final phase, stringBuilder.Append — Every character formed in each iteration will be added to the stringBuilder variable.

The following is the final output:


Thanks for the automation!!