Set variable with random number

Hi! An easy question. How can I set a variable with a random number?
Thank you for your help!

1 Like


int variable1=new Random().Next(1,100) This expression generates a random number between 1 to 100.



Thank you for your quick response, but where can I put this expression? In an assign module? In the variable definition?

that was typo error that was not . it was comma new Random().Next(1,100)

For your reference :


If the Random().Next() doesn’t work for you, there’s another solution is to use milliseconds.


milliseconds are practically random.


Great! Both solutions are working

hi i don’t understand “int variable1=new Random().Next(1,100)” From where this syntax comes from? any language based. Coz Rpa is coding free of any language.

It uses principles set out in VB. Lots of jobs in UiPath can be made easier / simpler with some knowledge of VB

VB.NET sorry. Speedy typing.

Hi @preethivj

Indeed RPA is code free from the perspective of drag&drop activities in the Flowchart for example. The activities are steps of the process. So even if not having programming skills & experience, Business operations people(or people who understand some programming notions at a basic level) can be trained(via Academy or other trainings) in using the RPA tools and automating processes in a really short time.


its been mentioned in the conversation that .net libraries is more enough for working with RPA.i checked syntax used in RPA are in both visual basic and .net libraries.