public static function get_randomString($length = 12, $type = 'pAan', $additional = '')
    {
        $sources = array(
            'p' => '!#$%&()=?*+-_:.;,<>',        // Punctuation
            'a' => 'abcdefghijklmnopqrstuvwxyz', // alpha
            'A' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', // Alpha
            'n' => '1234567890'                  // Numeric
        );
        
        $source = '';

        foreach ( $sources as $k => $s ) {
            if (strstr($type, $k)) {
                $source .= $s;
            }
        }

        $source .= $additional;

        if ($source == '') {
            throw new Exception('Type Error in get_randomString', 1);
        }
        
        srand((double)microtime()*1000000);
        $i = 0; $r = '';
        while ($i < $length) {
            $num = rand() % strlen($source);
            $tmp = substr($source, $num, 1);
            $r = $r . $tmp;
            $i++;
        }
        return $r;
    }