Change random generator to Bernoulli distribution
# Explain what has been changed # Explain why this change is being made # Provide links to any relevant tickets, articles or other resources
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "SMS.h"
|
||||
#include <random>
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user