Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!decwrl!adobe!hawley From: hawley@adobe.COM (Steve Hawley) Newsgroups: comp.sys.mac.programmer Subject: Re: ANSI and MacTrap in THINK C Message-ID: <11298@adobe.UUCP> Date: 19 Feb 91 19:44:56 GMT References: <16681@milton.u.washington.edu> Reply-To: hawley@adobe.UUCP (Steve Hawley) Organization: Adobe Systems Incorporated, Mountain View Lines: 22 In article <16681@milton.u.washington.edu> bose@milton.u.washington.edu (Rob Olsen) writes: >I'm writing a simple poker game to practice using C. At first I used rand() >and srand(clock()) for random numbers and it worked ok. Now I want to >use GetDateTime(&randSeed) and Random() with printf(), but for some reason >I get the same set of random numbers everytime. Is there a way to use >Random() and ANSI stdio at the same time? Or should I just forget about >Random() and just stick with rand()? I can't tell you why you're getting the same random numbers all the time, but you might want to try this instead: randSeed = TickCount(); /* seed the random number generator */ If you wish to retain the rand() srand() pair to keep compatability, just do what you were already doing. No harm. Steve Hawley hawley@adobe.com -- "Did you know that a cow was *MURDERED* to make that jacket?" "Yes. I didn't think there were any witnesses, so I guess I'll have to kill you too." -Jake Johansen