生成随机字符串

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#! perl
use strict;
use warnings;

my $type=3;
my $length=8;
my $count=3;
my @base_char=();

#1
my @number=(0..9);
#2
my @low_char=('a'..'z');
#4
my @big_char=('A'..'Z');
#8
my @other_char=('`','~','!','@','#','$','%','^','&','*','(',')','-','_','=','+','[','{','}',']','\\','|',';',':','"','\'',',','<','>','.','/','?');

@base_char=@number if($type==1);
@base_char=@low_char if($type==2);
@base_char=(@number,@low_char) if($type==3);
@base_char=@big_char if($type==4);
@base_char=(@number,@big_char) if($type==5);
@base_char=(@low_char,@big_char) if($type==6);
@base_char=(@number,@low_char,@big_char) if($type==7);
@base_char=@other_char if($type==8);
@base_char=(@number,@other_char) if($type==9);
@base_char=(@low_char,@other_char) if($type==10);
@base_char=(@number,@low_char,@other_char) if($type==11);
@base_char=(@big_char,@other_char) if($type==12);
@base_char=(@number,@big_char,@other_char) if($type==13);
@base_char=(@low_char,@big_char,@other_char) if($type==14);
@base_char=(@number,@low_char,@big_char,@other_char) if($type==15);

my @random_str=();
for(1..$count){
	my $str=join '',map {@base_char[int rand @base_char]} 0..($length-1);
	push(@random_str,$str)
}
print "@random_str\n";