Constrain parallel map keys to a smaller range
[libcds.git] / test / stress / map / insdelfind / map_insdelfind.h
index 296b1dad3d040a25d6664489cb92a0f12e9a5c1e..69cb7021b4c079f86c9845cd2204ab427940711e 100644 (file)
@@ -143,11 +143,12 @@ namespace map {
 
                 unsigned int i = 0;
                 size_t const nNormalize = size_t(-1) / ( s_nMapSize * 2 );
+                size_t const nKeyRange = s_nMapSize * 4;
 
                 size_t nRand = 0;
                 for (size_t pCount = 0; pCount < s_nPassCount; pCount++) {
                     nRand = cds::bitop::RandXorShift( nRand );
-                    size_t key = nRand / nNormalize;
+                    size_t key = nRand % nKeyRange + s_nMapSize;
                     nRand = cds::bitop::RandXorShift( nRand );
                     size_t value = nRand / nNormalize;
                     switch ( s_arrShuffle[i] ) {