Hi guys, I am trying to get a random number between two decimals. I have tried the typical modulus between a set but I got an invalid operand of double error.
Can someone tell me what that means? I've looked it up but it isn't clicking, thanks. while (std::abs(std::cos(BallAngle)) < rand (.8 % .4));
this function returns a sudo-random int. That means 4 bytes of random 1's and 0's.
.8%.4 is a bit of a strange equation since 0.8/0.4 is 2.0. Therefore 0.8%0.4 is 0. (as the remainder is 0).
I'm not exactley sure what you are trying to do, but to get a random number between 'min' and 'max' you need to do this:
1 2
int min, max;
rand()%(max-min) +min;
This is an integer value. You can manipulate this value as you like to make it into a double or float but until you get this value, you need to treat it as an int.