In article <048001c2f5e4$929b6000$0300a8c0 / austin.rr.com>, Hal E. Fulton <hal9000 / hypermetrics.com> wrote: >----- 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. I just finished up a GA class. It was one of the most interesting classes I've taken. > >> 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. > Yes, the lighter-weight solution definately is faster, but how it works is not obvious to me either. Phil