I’m trying to create 10 variables in multiple assign with text, i need to have the BOT randomly selecting one of the variables text each time and send it through the email.
so how can i select a random variable value each time?
I’m trying to create 10 variables in multiple assign with text, i need to have the BOT randomly selecting one of the variables text each time and send it through the email.
so how can i select a random variable value each time?
Hi @almousslli
You can’t do that, you should create an array of string, or add each value to a list, array etc. then you can get random value from that array
Hi @almousslli,
Use below syntax
For example
Random random = new Random()
int position = random.Next(0, arrValue.Length)
String value=arrValu(position)
Regards,
Arivu
Don’t create 10 variables. Create one array(of string) variable and populate it with your 10 values. Then create a variable with datatype System.Random and default it to New System.Random:
Then to get a random element from your array, with a max value of 9 (index 9 is the 10th element):
yourArrayVar(myRand.Next(9))
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.