I\'m trying to run several instances of a piece of code (2000 instances or so) concurrently in a computing cluster. The way it works is that I submit the jobs and the clust
If C++11 can be used then consider std::random_device. I would suggest you to watch link for a comprehensive guide.
Extracting the essential message from the video link : You should never use srand & rand, but instead use std::random_device and std::mt19937 -- for most cases, the following would be what you want:
#include
#include
int main() {
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_int_distribution dist(0,99);
for (int i = 0; i < 16; i++) {
std::cout << dist(mt) << " ";
}
std::cout << std::endl;
}