How can I use math.random()'s outputs to be biased towards a central value of 0.5. With values closer to 0.5 being the most commonly generated whilst values near 0 or 1 are rarer generated. Do I need to use sine with this or is there another method?
I don’t exactly know the search term for this topic so please send a link to an answer to this topic if you know it.
I don’t know anything about this subject, but this reminds me of Perlin Noise, where it randomly generates positions close to the other object’s position, which may help you.
I was able to find this library with the knowledge of that name.
--[[ Continuous Distributions ]]--
--[[**
Samples from a standard normal distribution (mean = 0, variance = 1)
Implementation is based on the Box-Muller (1958) transformation
@returns [t:number] A number sampled from the defined distribution
**--]]
statistics.distributions.standardNormal = function ()
local u1, u2
repeat u1 = math.random() u2 = math.random() until u1 > 0.0001
local logPiece = math.sqrt(-2 * math.log(u1))
local cosPiece = math.cos(2 * math.pi * u2)
return logPiece * cosPiece
end