// add adds a weighted item for selection.
add adds a weighted item for selection.
add adds a weighted item for selection .
fn add(&mut self, item: T, weight: isize) {
        let weight_item = RandWeightItem { item, weight };
        self.items.push(weight_item);
        self.n += 1;
        self.sum_of_weights += weight;
    }
fn add ( & mut self , item : T , weight : isize ) { let weight_item = RandWeightItem { item , weight } ; self . items . push ( weight_item ) ; self . n += 1 ; self . sum_of_weights += weight ; }
add adds a weighted item for selection.
add adds a weighted item for selection .
&mut self
item
T
weight
isize