i know math.random can randomly generate numbers, but i want to know is there a way to let the system decides which variable to choose from a and b?
i want to set both can randomly be selected (50 - 50) chance?

i know math.random can randomly generate numbers, but i want to know is there a way to let the system decides which variable to choose from a and b?
i want to set both can randomly be selected (50 - 50) chance?

Math.random generates numbers between 0.0 and 1.0
Half of that is 0.5.
Ideally then, numbers in [0.0, 0.5) have a 50% chance of getting generated.

Indeed. Method Math.random just uses java.util.Random anyway, and the class has a bunch of useful methods. Method Math.random is just leftover from the early API. When you think you need a source of randomness you should check out class Random first.