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=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no 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-17 09:16:01 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com!bos-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3D0E0B2B.67155BF9@despammed.com> From: Wes Groleau Reply-To: wesgroleau@despammed.com X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en,es-MX,es,pt,fr-CA,fr MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Discrete random with given distribution ? References: <3D0D0D48.B4B3156A@despammed.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 17 Jun 2002 11:15:39 -0500 NNTP-Posting-Host: 151.168.144.162 X-Complaints-To: news@ext.ray.com X-Trace: bos-service2.ext.raytheon.com 1024330561 151.168.144.162 (Mon, 17 Jun 2002 12:16:01 EDT) NNTP-Posting-Date: Mon, 17 Jun 2002 12:16:01 EDT Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:26164 Date: 2002-06-17T11:15:39-05:00 List-Id: > > Hmmm, that's not as clumsy as I thought it would be. :-) > Unfortunately, roundoff complicates it a bit. Consider: > Size = 10 If size is ten, you're only asking for one digit of accuracy. You could compute three and round back down to two instead of one. Or you could go with method two. > type Discrete_Things is (Apples, Bananas, Cantaloupes, Dates, Eggs); > Probability := (Apples .. Dates => => 0.04, Eggs => 0.84); > Integer( Probability(I) * Size) = 0 for I in Apples .. Dates > which is fine for a one digit accuracy, but > Integer( Probability(I) * Size) = 8 for I = Eggs > leaving Lookup(9 .. 10) undefined. And if you just select > from Lookup(1 .. 8), then Probability of random selection = Eggs is 100% -- Wes Groleau http://freepages.rootsweb.com/~wgroleau