src/Str.php
public static function random(int $charCount, string $characters = 'abcdefghijklmnopqrstuvqxyz0123456789'): string
    {
        $randomString = '';
        for ($i = 0; $i < $charCount; $i++) {
            $pos = mt_rand(0, strlen($characters) - 1);
            $randomString .= $characters[$pos];
        }

        return $randomString;
    }
public static function random(int $charCount, string $characters = 'abcdefghijklmnopqrstuvqxyz0123456789'): string
    {
        $randomString = '';
        for ($i = 0; $i < $charCount; $i++) {
            $pos = mt_rand(0, strlen($characters) - 1);
            $randomString .= $characters[$pos];
        }

        return $randomString;
    }
public static function random ( int $ charCount , string $ characters = 'abcdefghijklmnopqrstuvqxyz0123456789' ) : string { $ randomString = '' ; for ( $ i = 0 ; $ i < $ charCount ; $ i ++ ) { $ pos = mt_rand ( 0 , strlen ( $ characters ) - 1 ) ; $ randomString .= $ characters [ $ pos ] ; } return $ randomString ; }
Get a random string generated from provided values.

@param int    $charCount
@param string $characters
@return string
Get a random string generated from provided values .