From: "Richard Pett" Newsgroups: comp.os.msdos.djgpp Subject: Re: Randomizing Date: Mon, 30 Nov 1998 11:08:40 +1300 Organization: National Insitute of Water and Atmosphere (http://www.niwa.cri.nz) Lines: 107 Message-ID: <73sgr5$j64$1@clam.niwa.cri.nz> References: <000701be197f$f2d2e100$79f5ffc2 AT default> NNTP-Posting-Host: 161.65.68.240 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01C6_01BE1C51.C95174C0" X-Trace: clam.niwa.cri.nz 912377509 19652 161.65.68.240 (29 Nov 1998 22:11:49 GMT) X-Complaints-To: postmaster AT niwa DOT cri DOT nz NNTP-Posting-Date: 29 Nov 1998 22:11:49 GMT X-Newsreader: Microsoft Outlook Express 4.72.2106.4 X-Mimeole: Produced By Microsoft MimeOLE V4.72.2106.4 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. ------=_NextPart_000_01C6_01BE1C51.C95174C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Lazer ---=A4--- wrote in message = <000701be197f$f2d2e100$79f5ffc2 AT default>... Would anyone show me how to use rand()!! =20 I nede to get it to chose from 2 numbers =20 i've tryed this: =20 *********************************** #include =20 int main() { int my_number; my_number=3Drand()%2; printf("%d", my_number); } *********************************** =20 It always print 0 on the screen =20 Thanks!! =20 ---> Lazer =20 my_number=3Drand()*2 usually works for me. =20 Richard Pett (r DOT pett AT niwa DOT cri DOT nz) National Institute of Water and Atmospheric Research NIWA, Box 8602 Phone +64 3 3488987 Christchurch, New Zealand Fax +64 3 3485548 ------=_NextPart_000_01C6_01BE1C51.C95174C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
Lazer ---¤--- wrote in message=20 <000701be197f$f2d2e100$79f5ffc2 AT default>...
Would anyone show me how to use = rand()!!
 
I nede to get it to chose from 2 = numbers
 
i've tryed this:
 
***********************************
#include <stdio.h>
 
int main()
{
int my_number;
my_number=3Drand()%2;
printf("%d", my_number);
}
***********************************
 
It always print 0 on the = screen
 
Thanks!!
 
---> Lazer
 
my_number=3Drand()*2 usually = works for=20 me.
 
Richard Pett (r DOT pett AT niwa DOT cri DOT nz)
National=20 Institute of Water and Atmospheric Research
NIWA, Box=20 = 8602           &nb= sp;        =20 Phone +64 3 3488987
Christchurch, New = Zealand    =20 Fax   +64 3 = 3485548
------=_NextPart_000_01C6_01BE1C51.C95174C0--