🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

I need info on rand() and other fn.

Started by
0 comments, last by Sage13 22 years, 10 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()
//Just returns a random number from 0 - 32767

srand((unsigned)time(NULL));
// all this does is makes the number returned
// a little more random by seeding the random
// generator with the computer time

The #include stuff is just a bunch of functions
the program needs to work.
For example the program needs
#include
To have rand() and srand() functions available.

Your ":p" thingy, I''m not familiar with the function,
but it looks like just another variable passed to the function.

Probably defined like char *variable;

The prototype ( at the top of the program ) maybe something
like this:

void Draw_String( int var1, int var2, char *var3 );


Adulthood is the vehicle for making you childhood dreams come true.

This topic is closed to new replies.

Advertisement