Merge pull request #862 from DX-MON/master
common: Improved the random seed initialisation for the context
This commit is contained in:
commit
f5cc959c4e
@ -33,6 +33,7 @@
|
|||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <random>
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "design_utils.h"
|
#include "design_utils.h"
|
||||||
#include "json_frontend.h"
|
#include "json_frontend.h"
|
||||||
@ -223,12 +224,9 @@ void CommandHandler::setupContext(Context *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count("randomize-seed")) {
|
if (vm.count("randomize-seed")) {
|
||||||
srand(time(NULL));
|
std::random_device randDev{};
|
||||||
int r;
|
std::uniform_int_distribution<int> distrib{1};
|
||||||
do {
|
ctx->rngseed(distrib(randDev));
|
||||||
r = rand();
|
|
||||||
} while (r == 0);
|
|
||||||
ctx->rngseed(r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count("slack_redist_iter")) {
|
if (vm.count("slack_redist_iter")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user