Source of file Random.php
Size: 0,540 Bytes - Last Modified: 2021-12-23T10:19:36+00:00
/var/www/docs.ssmods.com/process/src/code/Random.php
123456789101112131415161718192021 | <?php /** * @file Random * * Generating random stuff * */ namespace SaltedHerring; class Random { public static function password($len = 8, $char_pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890') { $alphabet = $char_pool; $pass = array(); //remember to declare $pass as an array $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache for ($i = 0; $i < $len; $i++) { $n = rand(0, $alphaLength); $pass[] = $alphabet[$n]; } return implode($pass); //turn the array into a string } } |