From daadf799ce75aae9a4d7d9f26b73e573fda89851 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sun, 3 Jun 2012 11:24:19 +0300 Subject: [PATCH] Calc: Fixed int overflow with Random when using large bounds --- Library/MeasureCalc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/MeasureCalc.cpp b/Library/MeasureCalc.cpp index 6e496e7f..341e4faf 100644 --- a/Library/MeasureCalc.cpp +++ b/Library/MeasureCalc.cpp @@ -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)); }