Fixed: MattKing's change to RANDOM to fix issue where it was only random once.

This commit is contained in:
jsmorley 2010-02-28 14:19:35 +00:00
parent ed07f986fc
commit 2dbf79c6e6
2 changed files with 11 additions and 3 deletions

View File

@ -25,6 +25,7 @@
using namespace std;
hqStrMap* CMeasureCalc::c_VarMap = NULL;
bool CMeasureCalc::c_RandSeeded = false;
/*
** CMeasureCalc
@ -34,10 +35,15 @@ hqStrMap* CMeasureCalc::c_VarMap = NULL;
*/
CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow) : CMeasure(meterWindow)
{
m_Parser = MathParser_Create(NULL);
if(!c_RandSeeded)
{
c_RandSeeded = true;
srand((unsigned)time(0));
rand();
}
m_Parser = MathParser_Create(NULL);
rand();
}
/*
@ -147,6 +153,7 @@ void CMeasureCalc::RandomFormulaReplace()
while(loc > -1)
{
int range = (m_HighBound - m_LowBound);
srand((unsigned) rand());
int randNumber = m_LowBound + (range * rand()/(RAND_MAX + 1.0));
std::wstring randomNumberString= (L"");

View File

@ -40,6 +40,7 @@ private:
hqMathParser* m_Parser;
static hqStrMap* c_VarMap;
static bool c_RandSeeded;
int m_UpdateRandom;
int m_LowBound;