Lesson 2 Practice. Children's Guessing Game


#1

Hi,

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.

Vennie


#2

Hi,
It’s
new Random().Next(0,1000)
Random.xaml (7.1 KB)


#3

Hi,

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

Regards,

Vennie


#4

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


#5

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


#6

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


#7

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

Try this.
Right(Now.Millisecond.ToString,3)


#8

Hi,

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

Perhaps I have a technical issue?

Vennie


#9

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)


#10

@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


#11

Morning,

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.

Regards,

Vennie


#12

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)

Regards…!!
Aksh


#13

Hi,

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.

Regards,

Vennie


#14

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 ?