• Advertisement

Archived

This topic is now archived and is closed to further replies.

Visual C++ Randomize()

This topic is 6501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, i''m trying to make a black jack game for my data structurs class, and for some reason Visual C++ 6.0 can''t find the randomize() function. what header file is it in? i thought it was stdlib.h, but i''m still gettin the same error. if anyone has experienced the same problem, and knows how to get around it please let me know. thanks. -uncreativ president halosoft, inc. halosoft.hypermart.net

Share this post


Link to post
Share on other sites
Advertisement
randomize is a visual basic function and doesn''t exist for VC++.
use srand(UINT seed) instead. pass the current system time to the srand function to get real random numbers.

Share this post


Link to post
Share on other sites
To be more specific:

At the beginning of your program, put
srand(time(NULL));
to send a random seed to the random number generator. You only have to do this once your entire program.
Then when you need a random number,
int randomNumber = rand();

-fel

Share this post


Link to post
Share on other sites
thanks. it works perfectly.

-uncreativ

-uncreativ
president
halosoft, inc.
halosoft.hypermart.net

Share this post


Link to post
Share on other sites

  • Advertisement