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-14 14:13:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news-out.cwix.com!newsfeed.cwix.com!prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr13.news.prodigy.com.POSTED!3bae8248!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Discrete random with given distribution ? References: <3D0A3AB5.281CDDB9@despammed.com> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 64.175.241.43 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr13.news.prodigy.com 1024089162 ST000 64.175.241.43 (Fri, 14 Jun 2002 17:12:42 EDT) NNTP-Posting-Date: Fri, 14 Jun 2002 17:12:42 EDT Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: [[PAPDCAO@SIRQ@[ORHD]_\@VR]^@B@MCPWZKB]MPXHJUZ]CDVW[AKK[J\]^HVKHG^EWZHBLO^[\NH_AZFWGN^\DHNVMX_DHHX[FSQKBOTS@@BP^]C@RHS_AGDDC[AJM_T[GZNRNZAY]GNCPBDYKOLK^_CZFWPGHZIXW@C[AFKBBQS@E@DAZ]VDFUNTQQ]FN Date: Fri, 14 Jun 2002 21:12:42 GMT Xref: archiver1.google.com comp.lang.ada:25984 Date: 2002-06-14T21:12:42+00:00 List-Id: >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 Why not just use your second method (summing probabilities till you hit a certain level) to calculate, at run time, the population of a lookup table, then use the first method to speedily index into it to pick a random element.