?? randomgenerator.cpp
字號:
//////////////////////////////////////////////////////////////////////
// MuRoS - Multi Robot Simulator
//
// Luiz Chaimowicz
// GRASP Lab. University of Pennsylvania
// VERLab - DCC - UFMG - Brasil
//
// RandomGenerator.cpp: implementation of the RandomGenerator class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "simulator.h"
#include "RandomGenerator.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRandomGenerator::CRandomGenerator(double percent, int burst) : CGenerator()
{
p = percent / 100.0;
initburst = burst;
}
CRandomGenerator::~CRandomGenerator()
{
}
double CRandomGenerator::GetNumber()
{
double n;
n = ran1(&m_seed);
return(n);
}
BOOL CRandomGenerator::AboveThreshold()
{
return (GetNumber() > p);
}
BOOL CRandomGenerator::NoBurst()
{
if (burstcount > 0) {
burstcount--;
return (FALSE);
}
if (GetNumber() <= p){
burstcount = initburst-1;
return (FALSE);
}
else
return (TRUE);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -