home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / pascal / 7529 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  1.6 KB

  1. Path: sparky!uunet!spool.mu.edu!news.nd.edu!bsu-cs!bsu-ucs.uucp!00dfmeeker
  2. From: 00dfmeeker@leo.bsuvc.bsu.edu (David F. Meeker)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: help with die rolls...
  5. Message-ID: <1992Dec16.163958.13099@bsu-ucs>
  6. Date: 16 Dec 92 21:39:58 GMT
  7. References: <1992Dec16.170959.3637@csdvax.csd.unsw.edu.au>
  8. Organization: Broccoli Productions
  9. Lines: 38
  10.  
  11. In article <1992Dec16.170959.3637@csdvax.csd.unsw.edu.au>, p2112899@csdvax.csd.unsw.edu.au writes:
  12. > Could someone please show me how to get random die rolls going.
  13. > I am writing an attribute program for a roll playing game and need to roll die
  14. > for it.
  15. > The code I have done is:
  16. > for i := 0 to 3 do  pe := pe + random(6);
  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. > The minimum roll from 3 six sided die is 3, sometimes I get 2???
  20. > Any help will be appreciated.
  21. > Richard.
  22. > P2112899@csdvax.csd.unsw.edu.au
  23.  
  24.     Well, I've never been one to trust "random" number generators,
  25. so here's my technique....  (Picked it up in my Basic (BLECH!) days.. ;)
  26. Here's a little bit of pseudo-code:
  27.  
  28. Random number = int( random(100) * highest number / 100 )
  29.  
  30.     Use whatever number for random you think is appropriate / your
  31. compiler can handle... (I use 100, personally..)
  32.  
  33. Anyway, hope that helps..
  34.  
  35. -- 
  36. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  37. "But I know one thing that never dies: judgement on each one dead."
  38.  
  39. David F. Meeker            Ball State University, Muncie Indiana
  40. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  41. Internet: 00DFMEEKER@BSUVC.BSU.EDU
  42.