View Single Post
Old 05-23-2004, 04:12 AM   #6 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
Re: All spiced up

Quote:
Originally posted by liguorir
Code:
        // Determines random range to use
        int range =  ( 1+(int) (3.0*rand()/(RAND_MAX+1.0)) );
what is this nonsense? if you're trying to generate a number between 1 and 3, this is a terrible way to do it. try this instead:

Code:
int range = 1 + (rand() % 3);
joe_bruin is offline   Reply With Quote