How to call value inside global variable type range

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

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.

Ugly, but working solution:

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

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

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

OK thx

Have variable in the output,
like string output = sb.toString();

how I can call output in my globalvariable list

Thanks Advance,

Hi @aswithysasikumar

I don’t understand the problem yet.

If you need to add it to a string, then you just need to write:

List<String> globalVarAsListOfString = GlobalVariable.globalVar;
globalVarAsListOfString.add(output);

If not, then please explain more.