comp.lang.ada
 help / color / mirror / Atom feed
From: Wes Groleau <wesgroleau@despammed.com>
Subject: Re: Discrete random with given distribution ?
Date: Mon, 17 Jun 2002 11:15:39 -0500
Date: 2002-06-17T11:15:39-05:00	[thread overview]
Message-ID: <3D0E0B2B.67155BF9@despammed.com> (raw)
In-Reply-To: Q2eP8.468$Gu5.32969772@newssvr14.news.prodigy.com


> > 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



  reply	other threads:[~2002-06-17 16:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-13 12:10 Discrete random with given distribution ? Reinert Korsnes
2002-06-13 13:35 ` Larry Kilgallen
2002-06-13 12:49   ` Reinert Korsnes
2002-06-13 14:25 ` Wes Groleau
2002-06-13 16:10   ` Kevin Rigotti
2002-06-13 16:33   ` Jeffrey Carter
2002-06-13 22:23     ` Wes Groleau
2002-06-14  8:01     ` Gautier
2002-06-13 18:01   ` tmoran
2002-06-14  7:20     ` Reinert Korsnes
2002-06-14 18:49       ` Wes Groleau
2002-06-14 21:12         ` tmoran
2002-06-16 22:12           ` Wes Groleau
2002-06-17  5:01             ` tmoran
2002-06-17 16:15               ` Wes Groleau [this message]
2002-06-17 18:17                 ` tmoran
2002-06-18 19:22                   ` Wes Groleau
2002-06-19  0:34                     ` tmoran
2002-06-19  0:53                       ` tmoran
2002-06-19  5:13                       ` Robert I. Eachus
2002-06-14 10:01 ` Gautier
  -- strict thread matches above, loose matches on Subject: below --
2002-06-14 22:56 Gautier direct_replies_not_read
2002-06-14 23:10 ` tmoran
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox