mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Calc: Fixed int overflow with Random when using large bounds
This commit is contained in:
parent
d1b985d3f4
commit
daadf799ce
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user