----- Original Message -----
From: "Phil Tomson" <ptkwt / shell1.aracnet.com>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Saturday, March 29, 2003 1:44 AM
Subject: Re: Weighted random selection -- how would you do this?


> You're talking about some kind of proportional selection scheme (hey, you
> wouldn't happen to be working on Genetic Algorithms, would you?).

Not at the moment, but I've certainly had that in the
back of my mind for some time. Are you interested in
GAs? I am, but I'm not knowledgeable yet.

> One way
> would be to do what's called roulette wheel selection.  You can visualize
> a roulette wheel where each number is sized proportionally to the weight.
> The bigger the weight, the more likely the 'roulette wheel' is to land on
> that item.
>
> It would look something like:

[snip]

Fascinating and clever. But I'll probably
go with a lighter-weight solution.

Cheers,
Hal