I want to create an object at a random X location that is random on two ranges.
Like on the interval: [a, b] AND [c, d]
I might want to create an object that is outside the layer on either side.
Develop games in your browser. Powerful, performant & highly capable.
choose(int(random(A,B+1)), int(random(C,D+1)))
Thanks. Is there a way I can give weights to the arguments to choose()?
Like say I wanted it to generate a number on [10, 20] 1/3 of the time and [70,85] 2/3 of the time?
I mean I know for that specific example I could do like choose(random(10, 20), random(70, 85), random(70, 85))
But what if the weights weren't integers or large integers with no large common factors, so I'd have to spam the random()'s in many times?
I found a way:
Can't post url's yet but the thread was titled "Weighted probabilities"