function PageExampleTestCase::randomNumber

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.

1 call to PageExampleTestCase::randomNumber()
PageExampleTestCase::testPageExampleBasic in page_example/page_example.test
Functional test for various page types.

File

page_example/page_example.test, line 46

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;
}