How would I make a random number, say -2 through 2, that is a float, so it can be 2.0 or -1.04783. I don't really want code, just some suggestions. Thanks a lot!
How would I make a random number, say -2 through 2, that is a float, so it can be 2.0 or -1.04783. I don't really want code, just some suggestions. Thanks a lot!
Code is easier than writing out a longwinded explanation:
-PreludeCode:static double drand ( double low, double high ) { return ( (double)rand() * ( high - low ) ) / (double)RAND_MAX + low; }
My best code is written with the delete key.
Hey, thanks a lot, I never knew it was so simple. This saves me a lot of thinking. :-)