Information on rand() and other stuff...
Can some one please explain to me what this Fn. does and give me a very small example of how I can use it.
rand()
Also, what''s going on here. I know this is a fn. passing variables into it, but the last part I don''t understand. What is the " :p " ?
Draw_String(player_x,0,":p");
I would also like to know somehting about these header files:
#include
#include
And i think this fn. Has somehting to do with the time.h thing
srand((unsigned)time(NULL));
I''m getting this code from a windows game programming for dummies book by the way.
Thanx
rand() gives you a random (not really) number between 0 and RAND_MAX (which is either 0xFFFF or 0xFFFFFFFF)
The ":p" is the string to draw at x,y coords (player_x, 0).
Can''t see the include files, use " instead.
srand((unsigned)time(NULL)) set the randomize seed. This way, when you call rand, it won''t give you the same sequence of random numbers.
The ":p" is the string to draw at x,y coords (player_x, 0).
Can''t see the include files, use " instead.
srand((unsigned)time(NULL)) set the randomize seed. This way, when you call rand, it won''t give you the same sequence of random numbers.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement