Help in C

arrghh i can't take it i tried looking and thinking but i forgot how to creat a random number between 1 and 10 in C or any other languages, can any one remind me how to do it in C again plz asap thx


- geek -
Folding Team
Subscribed User
I have no C experience but a 2sec google search for this ...
rand_num = (int)((rand()%RAND_MAX)*9.0) + 1;
i think my compiler is dumb, can anyone point me out to a better C complier for windows, coz i tried compiling it on unix and i got all zeros
ok i got the borlan complier, but how do i set the path and stuff like that coz i dont understand anything form the readme.txt, it's telling me to creat a .cfg and append the current path etc.. i dont know how to do those can you help me out


Political User
#11 /* Dev-C++ */

As for random ints.

int rndnmr (int high, int low) {
        return int ( rand() / (RAND_MAX + 1.0) * (high-low+1) + low );
Enjoy :). Do make sure to run srand( time(NULL) ); somewhere in your code before you use that function. Best bet is it place it in main() right after the decleration.