Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Random.php

function Random::paragraphs

Generate paragraphs separated by double new line.

Parameters

int $paragraph_count: The number of paragraphs to create. Defaults to 12.

Return value

string

File

core/lib/Drupal/Component/Utility/Random.php, line 308

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)) . "\n\n";
    }
    return $output;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal