Information on rand() and other stuff...

Started by
0 comments, last by Sage13 22 years, 8 months ago
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
Advertisement
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.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

This topic is closed to new replies.

Advertisement