You are here

private function ContentBuilderForm::randomString in Schema.org configuration tool (RDF UI) 8

Generates a random string of lower case letters of a given length.

Parameters

int $length: Length of the random string.

Return value

string Return a random string.

1 call to ContentBuilderForm::randomString()
ContentBuilderForm::submitForm in rdf_builder/src/Form/ContentBuilderForm.php
@inheritdoc

File

rdf_builder/src/Form/ContentBuilderForm.php, line 438

Class

ContentBuilderForm

Namespace

Drupal\rdf_builder\Form

Code

private function randomString($length = 4) {
  $result = '';
  for ($i = 0; $i < $length; $i++) {
    $num = rand(97, 122);
    $result .= chr($num);
  }
  $result = $result . '_';
  return $result;
}