Hey =) How can you (If you can) choose between 2+ values? *Solved*
in
Programming Questions
•
11 months ago
Well, what I would like to do is create a variable with a value between -5 and -1 or 1 and 5? I'm aware I could do it a long winded way but I was wondering if there was an easy way of doing it? For example, in the programming language I have just moved on from (GML - GameMaker Language) there is a choose() function which has an equal chance of choosing each of the arguments, which would look like this in processing:
- int value = choose(int(random(-5, -1), int(random(1, 5));
This would give the variable 'value' a value ranging between either -5 to 1 or between 1 to 5.
Is there an easy way of doing this in processing?
Thanks in advance =)
KingD.
P.S. Sorry if I haven't been clear enough. Let me know and I'll be more clear if necessary =)
1