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-14 11:49:45 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.kjsl.com!HSNX.atgi.net!cyclone-sf.pbi.net!151.164.30.35!cyclone.swbell.net!bos-service1.ext.raytheon.com!dfw-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3D0A3AB5.281CDDB9@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: <3D08AB63.6AF60F95@despammed.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 14 Jun 2002 13:49:25 -0500 NNTP-Posting-Host: 151.168.144.162 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.raytheon.com 1024080585 151.168.144.162 (Fri, 14 Jun 2002 13:49:45 CDT) NNTP-Posting-Date: Fri, 14 Jun 2002 13:49:45 CDT Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:25966 Date: 2002-06-14T13:49:25-05:00 List-Id: > Yep, the quickest method may be to "discretize" the probabilities. > And the elements and their probabilities must in my case be given > during runtime so the approach above must be somehow generalised. My first method must be determined before compile time (Actually, there is a way to approximate it at run-time, but it is a bit clumsy) If the probabilities are to be determined at runtime, my second method will work, if you 1. Fix the typo two other folks detected, 2. Write code to assign the the probabilities: Sum := 0.0 for I in Threshold'Range loop Sum := Sum + Probability (I); Threshold (I) := Sum; end loop; if abs (Sum - 1.0) > Tolerance then raise Something_Is_Screwed_Up_Here; end if; -- Wes Groleau http://freepages.rootsweb.com/~wgroleau