From: Amos Jeffries Date: Sun, 8 Feb 2015 06:26:06 +0000 (-0800) Subject: Replace UFS use of random with C++11 feature X-Git-Tag: merge-candidate-3-v1~109^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c03adf02c521649b9ac5f007bdb7d50078a4e723;p=thirdparty%2Fsquid.git Replace UFS use of random with C++11 feature --- diff --git a/src/fs/ufs/UFSSwapDir.cc b/src/fs/ufs/UFSSwapDir.cc index d9fa01fc96..75db77f99b 100644 --- a/src/fs/ufs/UFSSwapDir.cc +++ b/src/fs/ufs/UFSSwapDir.cc @@ -33,6 +33,7 @@ #include #include +#include #if HAVE_SYS_STAT_H #include #endif @@ -1042,7 +1043,9 @@ Fs::Ufs::UFSSwapDir::CleanEvent(void *) * value. j equals the total number of UFS level 2 * swap directories */ - swap_index = (int) (squid_random() % j); + std::mt19937 mt(static_cast(getCurrentTime() & 0xFFFFFFFF)); + std::uniform_int_distribution<> dist(0, j); + swap_index = dist(mt); } /* if the rebuild is finished, start cleaning directories. */