In C++ i try to use modulo operator for two unsigned int variables like in Marsaglia's multiply with carry algorithm. The results seem right, but i'm not sure about the limitations of modulo.
m_upperBits = (36969 * (m_upperBits & 65535) + (m_upperBits >> 16))<<16;
m_lowerBits = 18000 * (m_lowerBits & 65535) + (m_lowerBits >> 16);
unsigned int sum = m_upperBits + m_lowerBits; /* 32-bit result */
unsigned int mod = (max-min+1);
int result=min+sum%mod;