Advertisement

Visual C++ Randomize()

Started by April 02, 2000 03:15 PM
2 comments, last by uncreativ 24 years, 7 months ago
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
-uncreativpresidenthalosoft, inc.halosoft.hypermart.net
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.
Advertisement
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
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
thanks. it works perfectly.

-uncreativ

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

This topic is closed to new replies.

Advertisement