Calc: Fixed int overflow with Random when using large bounds

This commit is contained in:
Birunthan Mohanathas 2012-06-03 11:24:19 +03:00
parent d1b985d3f4
commit daadf799ce

View File

@ -176,7 +176,7 @@ bool CMeasureCalc::GetMeasureValue(const WCHAR* str, int len, double* value)
int CMeasureCalc::GetRandom()
{
int range = (m_HighBound - m_LowBound) + 1;
double range = (m_HighBound - m_LowBound) + 1;
srand((unsigned)rand());
return m_LowBound + (int)(range * rand() / (RAND_MAX + 1.0));
}