Migrated map_find_int stress test to gtest
[libcds.git] / test / include / cds_test / fixture.h
index f8835e3a969658ecba9d029ba04a807259db783e..ec56e3276764abc7951c3e7192050d072153a407 100644 (file)
@@ -52,6 +52,13 @@ namespace cds_test {
 
             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