The standard derivation of the counter values

var c = new Counter[String].from(["a", "a", "b", "b", "b", "c"])
assert c.std_dev > 0.81
assert c.std_dev < 0.82

Property definitions

counter $ Counter :: std_dev
	# The standard derivation of the counter values
	#
	# ~~~
	# var c = new Counter[String].from(["a", "a", "b", "b", "b", "c"])
	# assert c.std_dev > 0.81
	# assert c.std_dev < 0.82
	# ~~~
	fun std_dev: Float do
		var avg = self.avg
		var sum = 0.0
		for value in map.values do
			sum += (value.to_f - avg).pow(2.0)
		end
		return (sum / map.length.to_f).sqrt
	end
lib/counter/counter.nit:249,2--263,4