You are not logged in.
Pages: 1
A tiny script but can be handy
also does anyone have a better name for it?
/// random_range_towards(mn, mx, to, f, int)
//
// returns real
//
// mn min value, real
// mx max value, real
// to the result will get closer towards this value, real
// f force towards the desired value, real (0-1)
// int round the result or not, bool
//
/// GMLscripts.com/license
function random_range_towards(mn, mx, to, f, int) {
var r = lerp(random_range(mn, mx), to, random(f));
return int ? round(r) : r;
}
min = 0, max = 100, towards = 10
force = 0
> average: 50
force = 0.5
> average: 42
force = 1
> average: 29
Last edited by maras (2021-07-26 12:09:52)
I'm on the official GM discord > maras_cz
Offline
Pages: 1