protected function _getRandomWord(array $words, $startingLetter = null)
    {
        $wordsToSearch = $startingLetter === null ? $words : preg_grep("/^{$startingLetter}/", $words);
        return $this->_randomizer ? $this->_randomizer->getArrayValue($wordsToSearch) : $wordsToSearch[array_rand($wordsToSearch)];
    }
protected function _getRandomWord(array $words, $startingLetter = null)
    {
        $wordsToSearch = $startingLetter === null ? $words : preg_grep("/^{$startingLetter}/", $words);
        return $this->_randomizer ? $this->_randomizer->getArrayValue($wordsToSearch) : $wordsToSearch[array_rand($wordsToSearch)];
    }
protected function _getRandomWord ( array $ words , $ startingLetter = null ) { $ wordsToSearch = $ startingLetter === null ? $ words : preg_grep ( "/^{$startingLetter}/" , $ words ) ; return $ this -> _randomizer ? $ this -> _randomizer -> getArrayValue ( $ wordsToSearch ) : $ wordsToSearch [ array_rand ( $ wordsToSearch ) ] ; }
Get a random word from the list of words, optionally filtering by starting letter.

@param array $words An array of words to choose from.
@param string $startingLetter The desired starting letter of the word.
@return string The random word.
Get a random word from the list of words optionally filtering by starting letter .