delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/09/20:47:57

From: "ghrea" <ge AT gea DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: random number generator
Lines: 19
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <8iIO5.10896$Wd3.1225815@typhoon.mn.mediaone.net>
Date: Fri, 10 Nov 2000 01:36:04 GMT
NNTP-Posting-Host: 24.163.167.54
X-Complaints-To: abuse AT mediaone DOT net
X-Trace: typhoon.mn.mediaone.net 973820164 24.163.167.54 (Thu, 09 Nov 2000 19:36:04 CST)
NNTP-Posting-Date: Thu, 09 Nov 2000 19:36:04 CST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ok, so I'm trying to create a program which uses a random number generator
for dice.  When I seed the random number I use "

srand(time(0));
a = rand() % 5;

This is more or less the standard way of doing a simple random number.  The
problem is when I compile the program it gives me the error:

Error: implicit declaration of function 'int time(...)'

Does anyone know how to fix this?







- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019