home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5929 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  46 lines

  1. Path: yama.mcc.ac.uk!liv!strath-cs!pcallagh
  2. From: pcallagh@cs.strath.ac.uk (Paul Callaghan)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Random #s
  5. Date: 21 Mar 1996 14:03:20 GMT
  6. Organization: Computer Science Dept., Strathclyde University., Glasgow, Scotland.
  7. Sender: pcallagh@cs.strath.ac.uk (Paul Callaghan CS94)
  8. Distribution: world
  9. Message-ID: <4irnj8$a2t@dunlop.cs.strath.ac.uk>
  10. References: <4ihkif$ed0@apollo.isisnet.com>
  11. NNTP-Posting-Host: lister-01.cs.strath.ac.uk
  12.  
  13. Here is a little program which will generate random numbers
  14. (Off the top of my head so it `should` work.)
  15. (rand() % MUTATE)+
  16. #include <time.h>
  17. #define HI 6
  18. #define LO 1
  19.  
  20.  
  21. void main()
  22. {
  23.  int rand_no;
  24.  
  25.  srand(time(NULL));
  26.  
  27.  rand_no=(rand() % HI)+LO;
  28. }
  29.  
  30. This generates a random number between HI and LO every time the program is run.
  31. (Doesn`t do anything with it bet generates it anyway :-)<-<)    
  32.  
  33. -- 
  34. ********************************************************************************
  35. pcallagh@cs.strath.ac.uk
  36. Paul Callaghan :- Second Year Computer Science and Avid Scheme Hater.
  37.  
  38. Microsoft:- Windows 2050,  This time We've got it right.
  39. Microsoft:- Windows 95, Bugs????? No they`re undocumented features
  40.         That`s half the FUN part.
  41. Pink Floyd:- "Shine On You Crazy Diamond."
  42. Me:- "AAAAAAAAAARRRRRRRRRRRGGGGGGGGGGHHHHHHHHHHHH!"
  43.  
  44. ********************************************************************************
  45.  
  46.