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