protected static function random($blockSize = Cuid::NORMAL_BLOCK)
    {
        // Get random integer
        $modifier = pow(Cuid::BASE36, Cuid::NORMAL_BLOCK);
        $random = mt_rand() / mt_getrandmax();

        $random = $random * $modifier;

        // Convert integer to hash
        $hash = Cuid::pad(
            base_convert(
                $random,
                Cuid::DECIMAL,
                Cuid::BASE36
            ),
            Cuid::NORMAL_BLOCK
        );

        // Limit hash if small block required
        if ($blockSize == Cuid::SMALL_BLOCK) {
            $hash = substr($hash, -2);
        }

        return $hash;
    }
protected static function random($blockSize = Cuid::NORMAL_BLOCK)
    {
        // Get random integer
        $modifier = pow(Cuid::BASE36, Cuid::NORMAL_BLOCK);
        $random = mt_rand() / mt_getrandmax();

        $random = $random * $modifier;

        // Convert integer to hash
        $hash = Cuid::pad(
            base_convert(
                $random,
                Cuid::DECIMAL,
                Cuid::BASE36
            ),
            Cuid::NORMAL_BLOCK
        );

        // Limit hash if small block required
        if ($blockSize == Cuid::SMALL_BLOCK) {
            $hash = substr($hash, -2);
        }

        return $hash;
    }
protected static function random ( $ blockSize = Cuid :: NORMAL_BLOCK ) { // Get random integer $ modifier = pow ( Cuid :: BASE36 , Cuid :: NORMAL_BLOCK ) ; $ random = mt_rand ( ) / mt_getrandmax ( ) ; $ random = $ random * $ modifier ; // Convert integer to hash $ hash = Cuid :: pad ( base_convert ( $ random , Cuid :: DECIMAL , Cuid :: BASE36 ) , Cuid :: NORMAL_BLOCK ) ; // Limit hash if small block required if ( $ blockSize == Cuid :: SMALL_BLOCK ) { $ hash = substr ( $ hash , - 2 ) ; } return $ hash ; }
Generate random hash

@return string Return random hash string
Generate random hash