Set variable with random number


#1

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


#2

Hey @ANGLEZ

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

Regards…!!
Aksh


#3

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


Variable contain a lot of values!
#4

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

For your reference : https://www.uipath.com/guides/flowcharts

Regards…!!
AKsh


#5

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

Right(Now.Millisecond.ToString,2)

milliseconds are practically random.


#6

Great! Both solutions are working
Thanks!


#7

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.


#8

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


#9

VB.NET sorry. Speedy typing.


#10

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.


#11

thanku


#12

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.