Generates random string.

Parameters

int $length: How many characters will this string contain.

array $pool: Array of characters to use.

Return value

string Random string.

Related topics

1 call to advagg_test_randon_string()
advagg_test_generate_selector_css in tests/advagg.test
Generates a large CSS string.

File

tests/advagg.test, line 73

Code

function advagg_test_randon_string($length, array $pool) {
    $string = '';
    $count = count($pool);
    for ($i = 0; $i < $length; $i++) {
        $string .= $pool[mt_rand(0, $count - 1)];
    }
    return $string;
}