Generates random string.

Paramètres

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

array $pool: Array of characters to use.

Return value

string Random string.

Sujets associés

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

Fichier

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