generating ginormous numbers

Hi!
My srand is generating a huge negative number, how can i fix this?
this is my function.

void Car::acceleration()
{
this->velocity+=rand()%10+1;
}
my guess - velocity was never initialized to 0.
I just tried that but nothing happened :-/

should I paste my code?
some of it.
as I thought. you don't have velocity = 0 in your default constructor (which is used for elements in array). therefore velocity == some rubbish.
lol, so simple -.-
I thought i didnt need to enter velocity in the default constructor...

thx a lot dude
Topic archived. No new replies allowed.