Random::string

public Random::string($length = 8, $unique = FALSE, $validator = NULL) Generates a random string of ASCII characters of codes 32 to 126. The generated string includes alpha-numeric characters and common miscellaneous characters. Use this method when testing general input where the content is not restricted. Parameters int $length: Length of random string to generate. bool $unique: (optional) If TRUE ensures that the random string returned is unique. Defaults to FALSE. callable $validator: (opt

Random::sentences

public Random::sentences($min_word_count, $capitalize = FALSE) Generates sentences Latin words, often used as placeholder text. Parameters int $min_word_count: The minimum number of words in the return string. Total word count can slightly exceed provided this value in order to deliver sentences of random length. bool $capitalize: Uppercase all the words in the string. Return value string Nonsense latin words which form sentence(s). File core/lib/Drupal/Component/Utility/Random.php, line 192

Random::paragraphs

public Random::paragraphs($paragraph_count = 12) Generate paragraphs separated by double new line. Parameters int $paragraph_count: Return value string File core/lib/Drupal/Component/Utility/Random.php, line 251 Class Random Defines a utility class for creating random data. Namespace Drupal\Component\Utility Code public function paragraphs($paragraph_count = 12) { $output = ''; for ($i = 1; $i <= $paragraph_count; $i++) { $output .= $this->sentences(mt_rand(20, 60)) . "

Random::object

public Random::object($size = 4) Generates a random PHP object. Parameters int $size: The number of random keys to add to the object. Return value \stdClass The generated object, with the specified number of random keys. Each key has a random string value. File core/lib/Drupal/Component/Utility/Random.php, line 169 Class Random Defines a utility class for creating random data. Namespace Drupal\Component\Utility Code public function object($size = 4) { $object = new \stdClass(); f

Random::name

public Random::name($length = 8, $unique = FALSE) Generates a random string containing letters and numbers. The string will always start with a letter. The letters may be upper or lower case. This method is better for restricted inputs that do not accept certain characters. For example, when testing input fields that require machine readable values (i.e. without spaces and non-standard characters) this method is best. Parameters int $length: Length of random string to generate. bool $unique: (

Random::MAXIMUM_TRIES

The maximum number of times name() and string() can loop. This prevents infinite loops if the length of the random value is very small. See also \Drupal\Tests\Component\Utility\RandomTest File core/lib/Drupal/Component/Utility/Random.php, line 20 Class Random Defines a utility class for creating random data. Namespace Drupal\Component\Utility Code const MAXIMUM_TRIES = 100;

Random::image

public Random::image($destination, $min_resolution, $max_resolution) Create a placeholder image. Parameters string $destination: The absolute file path where the image should be stored. int $min_resolution: int $max_resolution: Return value string Path to image file. File core/lib/Drupal/Component/Utility/Random.php, line 271 Class Random Defines a utility class for creating random data. Namespace Drupal\Component\Utility Code public function image($destination, $min_resolution, $max

Random::$strings

A list of unique strings generated by string(). Type: array File core/lib/Drupal/Component/Utility/Random.php, line 27 Class Random Defines a utility class for creating random data. Namespace Drupal\Component\Utility Code protected $strings = array();

Random::$names

A list of unique names generated by name(). Type: array File core/lib/Drupal/Component/Utility/Random.php, line 34 Class Random Defines a utility class for creating random data. Namespace Drupal\Component\Utility Code protected $names = array();

Random

Defines a utility class for creating random data. Hierarchy class \Drupal\Component\Utility\Random Related topics Utility classes and functions Overview of utility classes and functions for developers. File core/lib/Drupal/Component/Utility/Random.php, line 10 Namespace Drupal\Component\Utility Members Name Modifiers Type Description Random::$names protected property A list of unique names generated by name(). Random::$strings protected property A list of uniqu