protected function get_element_with_lowest_workload($workload) {
        $precision = 10;

        if (empty($workload)) {
            return false;
        }
        $minload = round(min($workload), $precision);
        $minkeys = array();
        foreach ($workload as $key => $val) {
            if (round($val, $precision) == $minload) {
                $minkeys[$key] = $val;
            }
        }
        return array_rand($minkeys);
    }
protected function get_element_with_lowest_workload($workload) {
        $precision = 10;

        if (empty($workload)) {
            return false;
        }
        $minload = round(min($workload), $precision);
        $minkeys = array();
        foreach ($workload as $key => $val) {
            if (round($val, $precision) == $minload) {
                $minkeys[$key] = $val;
            }
        }
        return array_rand($minkeys);
    }
protected function get_element_with_lowest_workload ( $ workload ) { $ precision = 10 ; if ( empty ( $ workload ) ) { return false ; } $ minload = round ( min ( $ workload ) , $ precision ) ; $ minkeys = array ( ) ; foreach ( $ workload as $ key => $ val ) { if ( round ( $ val , $ precision ) == $ minload ) { $ minkeys [ $ key ] = $ val ; } } return array_rand ( $ minkeys ) ; }
Selects an element with the lowest workload

If there are more elements with the same workload, choose one of them randomly. This may be
used to select a group or user.

@param array $workload [groupid] => (int)workload
@return mixed int|bool id of the selected element or false if it is impossible to choose
Selects an element with the lowest workload