Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
SOLVED: More randomness
I've set up a simple condition to generate a random number based on a seed value. The code is below. The problem is that no matter what I assign as the seed value, I keep getting the same sequence again and again.
What am I doing wrong?
returnValue = ((rand() % (m_iUpperBound - m_iLowerBound + 1)) + m_iLowerBound);
Never mind. I figured it out. Stupid error.
ZapB last edited by
Let me guess, you were setting the seed every time you wanted a random number? Typically you would seed the generator once, in the constructor say.
Yep! That's what I did.