From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,47a3564e17a59a63 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-07 17:55:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!newshub.northeast.verio.net!verio!news-out.cwix.com!newsfeed.cwix.com!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Pseudo Random coding problem References: <3e1b633f.3280604@news.demon.co.uk> X-Newsreader: Tom's custom newsreader Message-ID: <%xLS9.675327$NH2.47318@sccrnsc01> NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1041990907 12.234.13.56 (Wed, 08 Jan 2003 01:55:07 GMT) NNTP-Posting-Date: Wed, 08 Jan 2003 01:55:07 GMT Organization: AT&T Broadband Date: Wed, 08 Jan 2003 01:55:07 GMT Xref: archiver1.google.com comp.lang.ada:32715 Date: 2003-01-08T01:55:07+00:00 List-Id: > sometimes sees the value 20 and on other occasions doesn't. You are generating 30 random integer from 1 .. 50 (15 from the "Ada.Integer_Text_IO.Put" and another 15 from the "if Random_50.Random(Gen => G) = 20 then"). The probability that none of those is a 20 is (49/50)**30 = 0.55 If the 20 should come up on the "Ada.Integer_Text_IO.Put" you will see it printed out. Since those are half of the 30 calls, you ought to see "20" printed about 0.27 of the time. If the 20 comes up on the "if" statement instead, you won't see a 20 at all, but will instead see "Random Number is equal to Twenty". That also should happen on about 27% of the runs. Running your program 100 times, a quarter second apart (to let the random generator start differently), I see 26 of the runs output "Random Number is equal to Twenty" at least once. Sounds just about right.