On dev: SkipList: remove node state
[libcds.git] / test / include / cds_test / fixture.h
index f8835e3a969658ecba9d029ba04a807259db783e..0aefacc22118d85abc1c9cdf06596c0e0fab77b4 100644 (file)
@@ -48,10 +48,17 @@ namespace cds_test {
         static void shuffle( RandomIt first, RandomIt last )
         {
             static std::random_device random_dev;
-            static std::mt19937       random_gen( random_dev() );
+            static std::mt19937       random_gen( random_dev());
 
             std::shuffle( first, last, random_gen );
         }
+
+        static inline unsigned int rand( unsigned int nMax )
+        {
+            double rnd = double( std::rand()) / double( RAND_MAX );
+            unsigned int n = (unsigned int)(rnd * nMax);
+            return n < nMax ? n : (n - 1);
+        }
     };
 
 } // namespace cds_test