On Tue, Feb 26, 2019 at 04:01:15PM +0100, Tom Sommer wrote:
> > # Picks smtp1 90% of the time, smtp2 10% of the time.
> > randmap:{smtp1,smtp1,smtp1,smtp1,smtp1,smtp1,smtp1,smtp1,smtp1,smtp2}
>
> True, that is a way - although a litte bit of a workaround; setting 93%
> is a little bit of a mess :)
You'll probably find that 13 / 14 is close enough to 93%.
$ echo "2k 100 13 * 14 / p " | dc
92.85
More generally, if you're willing to limit yourself to even
percentiles, and mostly denominators up to 27, then the multiple
of 4 percentiles are just that fraction over 25 (reduced for multiples
of 20), while the rest can be well approximated via:
02% ~ 1 / 50 ~ 0.02
06% ~ 1 / 17 ~ 0.06
10% ~ 1 / 10 ~ 0.10
14% ~ 1 / 7 ~ 0.14
18% ~ 2 / 11 ~ 0.18
22% ~ 2 / 9 ~ 0.22
26% ~ 7 / 27 ~ 0.26
30% ~ 3 / 10 ~ 0.30
34% ~ 1 / 3 ~ 0.33
38% ~ 8 / 21 ~ 0.38
42% ~ 8 / 19 ~ 0.42
46% ~ 6 / 13 ~ 0.46
50% ~ 1 / 2 ~ 0.50
54% ~ 7 / 13 ~ 0.54
58% ~ 11 / 19 ~ 0.58
62% ~ 13 / 21 ~ 0.62
66% ~ 2 / 3 ~ 0.67
70% ~ 7 / 10 ~ 0.70
74% ~ 20 / 27 ~ 0.74
78% ~ 7 / 9 ~ 0.78
82% ~ 9 / 11 ~ 0.82
86% ~ 6 / 7 ~ 0.86
90% ~ 9 / 10 ~ 0.90
94% ~ 16 / 17 ~ 0.94
98% ~ 49 / 50 ~ 0.98
With must 2% and 98% requiring a larger denominator of 50. Postfix
won't suffer any performance loss choosing from a list of 50 or
less, and you can use a script to generate the randmap definition
for each desired percentile.
--
Viktor.