Oops, start deducting from the total count, not 0.

This commit is contained in:
Simon MacMullen 2012-12-12 11:28:04 +00:00
parent 936e55194b
commit c10de1dbb8
1 changed files with 4 additions and 4 deletions

View File

@ -573,12 +573,12 @@ apportion_sample0(Old, New, Id, Key, Count,
case New - Old1 of
0 -> record_sample(Id, {Key, Count, New, State}, State);
_ -> Rate = Count / (New - Old1),
Incr = round(Rate * Interval),
Rem = lists:foldl(
fun(I, CountN) ->
This = round(Rate * Interval),
record_sample(Id, {Key, This, I, State}, State),
CountN - This
end, 0, lists:seq(Old1, New1, Interval)),
record_sample(Id, {Key, Incr, I, State}, State),
CountN - Incr
end, Count, lists:seq(Old1, New1, Interval)),
record_sample(Id, {Key, Rem, New, State}, State)
end.