W3cubDocs

/Drupal 8

class 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 unique strings generated by string().
Random::image public function Create a placeholder image.
Random::MAXIMUM_TRIES constant The maximum number of times name() and string() can loop.
Random::name public function Generates a random string containing letters and numbers.
Random::object public function Generates a random PHP object.
Random::paragraphs public function Generate paragraphs separated by double new line.
Random::sentences public function Generates sentences Latin words, often used as placeholder text.
Random::string public function Generates a random string of ASCII characters of codes 32 to 126.
Random::word public function Generate a string that looks like a word (letters only, alternating consonants and vowels).

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Random.php/class/Random/8.1.x