public function generatePassword()
{
$characterList = $this->getCharacterList()->getCharacters();
$characters = \strlen($characterList);
$password = '';
$segmentCount = $this->getSegmentCount();
$segmentLength = $this->getSegmentLength();
for ($i = 0; $i < $segmentCount; ++$i) {
if ($password) {
$password .= $this->getSegmentSeparator();
}
for ($j = 0; $j < $segmentLength; ++$j) {
$password .= $characterList[$this->randomInteger(0, $characters - 1)];
}
}
return $password;
}