src/Generator.php
public function getString($type = 'letter', $desired_length = null)
	{
		if (empty($desired_length)) {
			$desired_length = $this->getInteger(1, 50);
		}
		
		$result = '';
		
		while (strlen($result) < $desired_length) {
			if ($type == 'letter') {
				$result .= $this->getLetter();
			} elseif ($type == 'number') {
				$result .= $this->getInteger(1, 10);
			} else {
				// Mix letters/numbers.
				$result .= $this->getUniqueHash();
			}
		}
		
		return substr($result, 0, $desired_length);
	}
public function getString($type = 'letter', $desired_length = null)
	{
		if (empty($desired_length)) {
			$desired_length = $this->getInteger(1, 50);
		}
		
		$result = '';
		
		while (strlen($result) < $desired_length) {
			if ($type == 'letter') {
				$result .= $this->getLetter();
			} elseif ($type == 'number') {
				$result .= $this->getInteger(1, 10);
			} else {
				// Mix letters/numbers.
				$result .= $this->getUniqueHash();
			}
		}
		
		return substr($result, 0, $desired_length);
	}
public function getString ( $ type = 'letter' , $ desired_length = null ) { if ( empty ( $ desired_length ) ) { $ desired_length = $ this -> getInteger ( 1 , 50 ) ; } $ result = '' ; while ( strlen ( $ result ) < $ desired_length ) { if ( $ type == 'letter' ) { $ result .= $ this -> getLetter ( ) ; } elseif ( $ type == 'number' ) { $ result .= $ this -> getInteger ( 1 , 10 ) ; } else { // Mix letters/numbers. $ result .= $ this -> getUniqueHash ( ) ; } } return substr ( $ result , 0 , $ desired_length ) ; }
Generate random string.

@access public
@param string $type Options: letter, number, or mix.	 default: letter
@param mixed $desired_length Will be random length if not specified.
@return string
Generate random string .