/*
This file is a part of libcds - Concurrent Data Structures library
- (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017
Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
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