From: Endlisnis Newsgroups: comp.os.msdos.djgpp Subject: Re: Begginer question about Randomizing the timer. Date: Mon, 17 May 1999 19:52:18 -0400 Organization: BrunNet Lines: 26 Message-ID: <3740ABB2.7AB492B5@unb.ca> References: NNTP-Posting-Host: ftnts4c38.brunnet.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.51 [en] (Win95; U) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Fire-Breathing Penguin wrote: > How do you get a random number? In QBASIC it would be done as > RANDOMIZE TIMER > X=INT(RND*10)+1 > . Is there any way to do the same in C/C++? #include #include int main() { srand(time(0)); int x = rand(10)%10+1; return 0; } -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT HotMail DOT com ICQ: 32959047