   a WTF kind of c++ problem (Solved)
  Has anybody ever encountered a problem where something would work correctly if you debug it line by line, but fails otherwise? I upgraded from VC6 to VC8 today, which i never even considered doing before, because of this stupid problem, but it still does it.for( i = 0; i < COUNT; i++ ){    if( Test( CHANCE ) )    {   suc++;    }}COUNT is 100, and CHANCE is 0.50f. The Test function should have a 0.50f (50%) chance of returning true. So suc should be between 45 and 55 at the end of this loop. It does when i debug it line by line, but otherwise suc always comes out as 100. I've never had a problem like this until today, and I can't explain why it would do anything like that. Any help is appreciated.Oh and 1 more thing: does VC8 generate faster code than VC6?   
  AHHHHHHHH!!!!!!!!!!!!!!!!!!!!Like always, i found the problem right after i posted a question about it. My random number function uses GetTickCount, and when it is called with such a short time since it was last called, it returns the same answer. Thanks for your time.   ;Quote:Original post by F-KopAHHHHHHHH!!!!!!!!!!!!!!!!!!!!Like always, i found the problem right after i posted a question about it. My random number function uses GetTickCount, and when it is called with such a short time since it was last called, it returns the same answer. Thanks for your time.I'm taking a guess here, but are you seeding the random number generator more than once? You should only seed it once.   ;Quote:Original post by F-KopMy random number function uses GetTickCountSeed your random only once.;  It's only seeded once, but it uses GetTickCount again when Rand is called.   ;Quote:Original post by F-KopIt's only seeded once, but it uses GetTickCount again when Rand is called.In what way? I can only imagine you using GetTickCount to seed it.   ;Quote:Original post by F-KopIt's only seeded once, but it uses GetTickCount again when Rand is called.Then feed the last random number back into the calculation or something similar. Otherwise, it is 'seeded' every time you call it.   