1 page_example.test protected static PageExampleTestCase::randomNumber($length = 8)

Generates a random string of ASCII numeric characters (values 48 to 57).

Parameters

int $length: Length of random string to generate.

Return value

string: Randomly generated string.

File

modules/examples/page_example/tests/page_example.test, line 34
Test case for Testing the page example module.

Class

PageExampleTestCase
Functional tests for the Page Example module.

Code

protected static function randomNumber($length = 8) {
  $str = '';
  for ($i = 0; $i < $length; $i++) {
    $str .= chr(mt_rand(48, 57));
  }
  return $str;
}