mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
7c9fd3ea84
Use _even_rand() function instead of floor() in _bitset_with_random_bits(). floor() function is missing in dietlibc (on architectures other than x86). Moreover using floor() to clip rand results does not assure even result distribution. _even_rand() uses integer arithmetic only and is designed to return evenly distributed results. > Looks OK to me. It took a while to decipher what is the exact meaning of > the loop in _even_rand (to a non-pseudorandomness-expert) but I am > fairly comfortable with it now. If I understand this correctly, it > rejects numbers that come from an "incomplete" slice of the RAND_MAX > space (considering the number space [0, RAND_MAX] is divided into some > "max"-sized slices and at most a single smaller slice, between [n*max, > RAND_MAX] for suitable n -- numbers from this last slice are discarded > because they could distort the distribution in favour of smaller > numbers). Signed-off-by: Przemyslaw Iskra <sparky <at> pld-linux.org> Reviewed-by: Petr Rockai <prockai <at> redhat.com> |
||
---|---|---|
.. | ||
lv_alloc.h | ||
lv_manip.c | ||
lv.c | ||
lv.h | ||
merge.c | ||
metadata-exported.h | ||
metadata.c | ||
metadata.h | ||
mirror.c | ||
pv_alloc.h | ||
pv_manip.c | ||
pv_map.c | ||
pv_map.h | ||
pv.c | ||
pv.h | ||
replicator_manip.c | ||
segtype.c | ||
segtype.h | ||
snapshot_manip.c | ||
vg.c | ||
vg.h |