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,6e2278eaed9619d6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-13 09:33:26 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!ihug.co.nz!cox.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!59ce1190!not-for-mail Message-ID: <3D08C94B.A50AECFE@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Discrete random with given distribution ? References: <3D08AB63.6AF60F95@despammed.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 13 Jun 2002 16:33:19 GMT NNTP-Posting-Host: 63.184.105.169 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1023985999 63.184.105.169 (Thu, 13 Jun 2002 09:33:19 PDT) NNTP-Posting-Date: Thu, 13 Jun 2002 09:33:19 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:25885 Date: 2002-06-13T16:33:19+00:00 List-Id: Wes Groleau wrote: > > Threshold : array (Out_Type) of Float := > (A => 0.50, > B => 0.75, -- previous plus Probability (B) > C => 1.00); -- previous plus Probability (C) > > F := FR.Random; > Loop_With_Jump_Out: > for I in Out_Type loop > if F > Threshold (I) then > return I; > end if; > end loop Loop_With_Jump_Out; This can never return C. F <= 1.0, and for many generators, F < 1.0. Also, if F = 0.9, this returns A. I suspect you need F < Threshold (I) -- Jeff Carter "Oh Lord, bless this thy hand grenade, that with it thou mayst blow thine enemies to tiny bits, in thy mercy." Monty Python and the Holy Grail