diff --git a/DRAMSys/simulator/src/controller/scheduler/SMS.cpp b/DRAMSys/simulator/src/controller/scheduler/SMS.cpp index 147cea6e..533498ef 100644 --- a/DRAMSys/simulator/src/controller/scheduler/SMS.cpp +++ b/DRAMSys/simulator/src/controller/scheduler/SMS.cpp @@ -1,4 +1,5 @@ #include "SMS.h" +#include using namespace std; @@ -72,12 +73,15 @@ bool SMS::batchFormation() void SMS::batchScheduler() { sc_time memClk = Configuration::getInstance().memSpec.clk; + std::default_random_engine generator; + std::bernoulli_distribution distribution((double) SJFprobability / 100.0); + bool isSJF; + while (true) { wait(memClk); - srand(time(NULL)); - bool isSJF = (rand() % 100) < SJFprobability; + isSJF = distribution(generator); if (!existReadyBatch()) { // pick & drain a ready batch