diff --git a/addons/dice_syntax/dice_syntax.gd b/addons/dice_syntax/dice_syntax.gd index 525f552..4a548cb 100644 --- a/addons/dice_syntax/dice_syntax.gd +++ b/addons/dice_syntax/dice_syntax.gd @@ -110,6 +110,12 @@ static func expected_value(probs:Dictionary)->float: out += probs[k]*float(k) return(out) +static func standard_deviation(probs:Dictionary)->float: + var out = 0 + var mean = expected_value(probs) + for k in probs.keys(): + out += pow(float(k)-mean,2)*probs[k] + return pow(out,0.5) static func roll_from_probs(probs:Dictionary,rng:RandomNumberGenerator,n=1)->Array: var al = preload('array_logic.gd') diff --git a/addons/dice_syntax/plugin.cfg b/addons/dice_syntax/plugin.cfg index f30cbac..13a594d 100644 --- a/addons/dice_syntax/plugin.cfg +++ b/addons/dice_syntax/plugin.cfg @@ -3,5 +3,5 @@ name="dice_syntax" description="Dice rolling syntax" author="Ogan Mancarci" -version="2.1.3" +version="2.2.0" script="plugin.gd"