In article <2003329153016.190722 / PADD>,
Austin Ziegler  <austin / halostatue.ca> wrote:
>On Sun, 30 Mar 2003 04:07:22 +0900, Phil Tomson wrote:
>> I tried running it a few times and well it seems to work.
>> 
>> I was just thinking that the order of the elements in the list
>> could influence which is picked (for example if elements with high
>> weights appeared earlier or later in the list), but it doesn't
>> seem to be the case. Certainly a lot more compact and faster than
>> my RouletteWheel example.
>
>Couldn't order affect the results if more than one item share the
>same weight?
>

Well, you're getting some randome number between 0 and 1.  So let's say 
that all 'slots' have equal weight (say there are 4 slots of .25) then you 
get your random number and find out which slot it lies in.  Even though 
each slot is equal in this example, order shouldn't bias the selection.  I 
suppose the other 'lighter' solution proposed by Daniel works similarly.

Phil