travis: clang needs high resolution rnd seeds
authorMichael Wallner <mike@php.net>
Tue, 15 Sep 2020 18:26:18 +0000 (20:26 +0200)
committerMichael Wallner <mike@php.net>
Tue, 15 Sep 2020 18:26:18 +0000 (20:26 +0200)
testing/lib/random.cpp
testing/tests/memcached/regression/lp434843.cpp

index f312d8bdb9211eb4f9f99e0f1fb5bf88832009cd..9d4e8a5d5c522f08dd62d5a1b7207445a41a3cb4 100644 (file)
@@ -13,7 +13,7 @@ enable_if_t<is_integral_v<T>, T> random_num(T min, T max) {
   using rnd = mt19937;
   using dst = uniform_int_distribution<T>;
 
-  auto time = duration_cast<microseconds>(system_clock::now().time_since_epoch());
+  auto time = duration_cast<nanoseconds>(system_clock::now().time_since_epoch());
   auto seed = static_cast<rnd::result_type>(time.count() % numeric_limits<T>::max());
   auto rgen = rnd{seed};
   return dst(min, max)(rgen);
index 87f8539911e7d0722cdb88f0a3531b09d2455807..9a372a8c9364e6e42452ab7b7aba909ff86e1484 100644 (file)
@@ -28,9 +28,10 @@ TEST_CASE("memcached_regression_lp434843") {
   array<size_t, NUM_KEYS> len;
   
   for (auto i = 0; i < NUM_KEYS; ++i) {
-    str[i] = random_ascii_string(random_num<size_t>(24, 32));
+    str[i] = random_ascii_string(36);
     chr[i] = str[i].data();
     len[i] = str[i].length();
+    cerr << str[i] << endl;
   }
 
   REQUIRE_SUCCESS(memcached_mget(memc, chr.data(), len.data(), NUM_KEYS));