All pastes #73083 Raw Edit

Mine

public text v1 · immutable
#73083 ·published 2006-06-27 13:08 UTC
rendered paste body
function AceUtilsMaths:Quartiles(values) -- Won't return middle quartile, since it's the same as the median and you can do :Median() for that
	local n = table.getn(values)
	table.sort(values)
	local lowerQPos = n * 0.25 + 0.25
	local upperQPos = lowerQPos * 3 - 0.25
	return (values[math.floor(lowerQPos)] + values[math.ceil(lowerQPos)]) / 2, (values[math.floor(upperQPos)] + values[math.ceil(upperQPos)]) / 2
end