home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pascal / 7605 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  919 b 

  1. Path: sparky!uunet!pipex!warwick!uknet!gdt!aber!dpl
  2. From: dpl@aber.ac.uk (David Philip Langstaff)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: help with die rolls...
  5. Message-ID: <1992Dec21.121216.9636@aber.ac.uk>
  6. Date: 21 Dec 92 12:12:16 GMT
  7. References: <1992Dec16.170959.3637@csdvax.csd.unsw.edu.au>
  8. Organization: University of Wales, Aberystwyth
  9. Lines: 19
  10.  
  11. In article <1992Dec16.170959.3637@csdvax.csd.unsw.edu.au> p2112899@csdvax.csd.unsw.edu.au writes:
  12. >
  13. >The code I have done is:
  14. >
  15. >for i := 0 to 3 do  pe := pe + random(6);
  16. >
  17. >to roll a 6 sided die 3 times, but it doesn't work as it should. Some values
  18. >produced are actually lower than possible.
  19. >
  20. 0 <= Random(x) < x
  21.   ^^           ^
  22.  
  23. So use Random(6) + 1 to simulate a die
  24.  
  25.  
  26. -- 
  27. Dave Langstaff | Janet:dpl@uk.ac.aber
  28. Any views expressed are those of the author alone. | Phone:(0970)622838 
  29. After-life, After-shave, don't hold with any of it, bleugh! - Sir Henry 
  30.