src/Model/PasswordAndTokenTrait.php
public function generatePassword($length = 8, $options = []) {
		$options = $this->_passwordDictionary($options);
		$password = '';

		srand((int)microtime() * 1000000);
		for ($i = 0; $i < $length; $i++) {
			$password .=
				$options['cons'][mt_rand(0, count($options['cons']) - 1)] .
				$options['vowels'][mt_rand(0, count($options['vowels']) - 1)];
		}

		return substr($password, 0, $length);
	}
public function generatePassword($length = 8, $options = []) {
		$options = $this->_passwordDictionary($options);
		$password = '';

		srand((int)microtime() * 1000000);
		for ($i = 0; $i < $length; $i++) {
			$password .=
				$options['cons'][mt_rand(0, count($options['cons']) - 1)] .
				$options['vowels'][mt_rand(0, count($options['vowels']) - 1)];
		}

		return substr($password, 0, $length);
	}
public function generatePassword ( $ length = 8 , $ options = [ ] ) { $ options = $ this -> _passwordDictionary ( $ options ) ; $ password = '' ; srand ( ( int ) microtime ( ) * 1000000 ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ password .= $ options [ 'cons' ] [ mt_rand ( 0 , count ( $ options [ 'cons' ] ) - 1 ) ] . $ options [ 'vowels' ] [ mt_rand ( 0 , count ( $ options [ 'vowels' ] ) - 1 ) ] ; } return substr ( $ password , 0 , $ length ) ; }
Generates a random password that is more or less user friendly.

@param int $length Password length, default is 8
@param array $options Options array.
@return string
Generates a random password that is more or less user friendly .