src/Decider.php
/**
     * Chooses a value from an array
     *
     * @throws LogicException If array has no elements
     *
     * @param  Array  $array Array of choices to choose an element from
     * @param  string $salt  OPTIONAL Salt to personalise choice
     *
     * @return mixed Chosen array value
     */
Chooses a value from an array
@throws LogicException If array has no elements

@param  Array  $array Array of choices to choose an element from
@param  string $salt  OPTIONAL Salt to personalise choice

@return mixed Chosen array value
Chooses a value from an array @throws LogicException If array has no elements @param Array $array Array of choices to choose an element from @param string $salt OPTIONAL Salt to personalise choice @return mixed Chosen array value
public function chooseElement(Array $array, $salt = null)
    {
        $choices     = array_keys($array);
        $num_choices = count($choices);
        if ($num_choices === 0) {
            throw new LogicException('Array has no elements to choose one from');
        }
        $choice = $this->chooseNumber(0, $num_choices - 1, $salt);
        return $array[$choices[$choice]];
    }
public function chooseElement ( Array $ array , $ salt = null ) { $ choices = array_keys ( $ array ) ; $ num_choices = count ( $ choices ) ; if ( $ num_choices === 0 ) { throw new LogicException ( 'Array has no elements to choose one from' ) ; } $ choice = $ this -> chooseNumber ( 0 , $ num_choices - 1 , $ salt ) ; return $ array [ $ choices [ $ choice ] ] ; }
Chooses a value from an array
 @throws LogicException If array has no elements
Chooses a value from an array @throws LogicException If array has no elements