public function lookup() {
        $r = mt_rand() / mt_getrandmax() * $this->_weightTotal;
        return $this->_values[$this->_binarySearch($r, $this->_lookup)];
    }
public function lookup() {
        $r = mt_rand() / mt_getrandmax() * $this->_weightTotal;
        return $this->_values[$this->_binarySearch($r, $this->_lookup)];
    }
public function lookup ( ) { $ r = mt_rand ( ) / mt_getrandmax ( ) * $ this -> _weightTotal ; return $ this -> _values [ $ this -> _binarySearch ( $ r , $ this -> _lookup ) ] ; }
Randomly select one of the elements based on their weights.

@return mixed Selected element
Randomly select one of the elements based on their weights .