Lesson 2 Practice. Children's Guessing Game



I am trying to get the Random Number Generator to work in this Practice.

I’ve dragged an Assign box into the Flowchart, created a new variable names Random but, I cannot seem to get the Random Number Generator command correct.

I am entering new Random().Next{0.1000} but it doesn’t work. In fact, I have tried a whole host of combinations without success. Please can anyone give me the correct command?

Thank you.



new Random().Next(0,1000)
Random.xaml (7.1 KB)



Thank you for your reply. However I have tried that and I’m still getting an error. Please see scree shot below.




I don’t see any screenshot.
Did you run my code?


yes I did and I get this error message "Compiler error encountered processing exception new Random().Next(0,1000) end of expression expected


Ah, just put a full stop at the end and now the error message says “identifier expected”?


No need of full stop.
Its a simple method. It should work
Its working fine for me .:roll_eyes:

Try this.



Thanks again for your response. I have tried both versions you sent me but neither of them work

Perhaps I have a technical issue?



come on man…:neutral_face:
It’s very simple.
What could possibly go wrong in that .:stuck_out_tongue:
@ovi is there something do with uipath studio itself.(version updates)


@ddpadil Studio Community Edition updates automatically, so no :smiley:
@Vennie i would suggest to go through all the lessons, because there are walkthroughs and answers to every practical exercise



Thank you both for your responses. Working through the lessons is what I am trying to do. This is the first practice on Lesson 2. I’ll check to see if there are any updates.




In your workflow you are still using { brackets. please replace it with small brackets “( )”

Int32 random_number = New Random().Next(0,1000) // will work.

or just download attached sample workflow and run it.
Main.xaml (7.2 KB)




Thank you all for your help but, I have just this minute worked out resolved the problem.
I do though appreciate the help from all of you.




Hi Vennie -
Even I am facing the same issue. Used below code to create random number.
Int32 rnd= new Random().Next(1,1000)

Error: TYPE Random.Next() is not defined

What is the work around u did ?


By the way there are many benefits of playing a game like it improves our attention and concentration, enhances memory, etc. I think it is great task taken by you.