comp.lang.ada
 help / color / mirror / Atom feed
* Re: Discrete random with given distribution ?
@ 2002-06-14 22:56 Gautier direct_replies_not_read
  2002-06-14 23:10 ` tmoran
  0 siblings, 1 reply; 23+ messages in thread
From: Gautier direct_replies_not_read @ 2002-06-14 22:56 UTC (permalink / raw)


tmoran:

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

And why not replace the loop by the traversal of a binary
tree ? (I just don't like that lookup table...)
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, address on the Web site!

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com




^ permalink raw reply	[flat|nested] 23+ messages in thread
* Discrete random with given distribution ?
@ 2002-06-13 12:10 Reinert Korsnes
  2002-06-13 13:35 ` Larry Kilgallen
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Reinert Korsnes @ 2002-06-13 12:10 UTC (permalink / raw)


Hi,

Is it under Ada any "natural" way to generate random
elements of enumeration type (for example (a,b,c))
and with a given non-uniform probability distribution ?

I.e. so for example "a" is produced by probability 1/2
and "b" and "c" both with probability 1/4 ?

(Yes, I can do it via Float_Random, but the code looks ugly). 

reinert



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2002-06-19  5:13 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-14 22:56 Discrete random with given distribution ? Gautier direct_replies_not_read
2002-06-14 23:10 ` tmoran
  -- strict thread matches above, loose matches on Subject: below --
2002-06-13 12:10 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
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

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