How to call value inside global variable type range


#1

Hi,

I want ask about how to call value inside global variable type range

I have create global variable

RandomNumber [1…999]

but when I call the global variable, Globalvariable.RandomNumber, the result displayed 1…999 not pick the random value range


#2

hmmm i think what you defined is global variable with name “RandomNumber” defined as range 1…999. am i right?
you can use this range to pass it to some function that will generate random no. from that range.


#3

Ugly, but working solution:

IntRange ir = GlobalVariable.RandomNumberint randomNumber = ir.get(new Random().nextInt(ir.getTo() - ir.getFrom() + 1) + ir.getFrom())

#4

Andrej Podhajský said:

hmmm i think what you defined is global variable with name “RandomNumber” defined as range 1…999. am i right?
you can use this range to pass it to some function that will generate random no. from that range.

yes it is global variable type range

I have tried to call global variable by type ‘Globalvariable.RandomNumber’, but it give result ‘1…9999’, not a random number between 1 and 9999

Screen Shot 2018-07-11 at 19.02.09.png


#5

ok, again … it’s jut range … there is no function behind that will pick anything … just definition of range … look at @Marek Melocik solution

@Marek - Upvote from me


#6

OK thx