Constrain parallel map keys to a smaller range
authorPeizhao Ou <peizhaoo@uci.edu>
Thu, 15 Feb 2018 22:17:41 +0000 (14:17 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Thu, 15 Feb 2018 22:17:41 +0000 (14:17 -0800)
test/stress/map/insdelfind/map_insdelfind.h

index 296b1da..69cb702 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] ) {