The term you are looking for is Weighted Random Numbers
, most of the algorithms I have seen use trig functions, but I think I figured out a way that will be efficient.:
Create a table/array/List(whatever) that holds a multiplier value for the random function. Fill it out by hand or programatically...
randMulti= {.1,.1,.1,.1,.1,.1,.2,.2,.3,.3,.9,1,1,1,}
then...then Multiply random
by a randomly chosen randMulti
and finally by the max Value of the distrobutiondistribution...
weightedRandom = math.random()*randMulti[Math.random(randMulti.length)]*maxValue
I do believe that this will be much faster than using sqrtsqrt
, or other more computationalcomputationally complex functions, and will allow for more custom grouping patterns.