sub sys_true_rand {
my ($num_char) = @_; # Число символов в качестве параметра.
my $dev_line;
my $rand_line = "";
open(UR,"</dev/urandom") || die "Cam't open /dev/urandom"";
do {
read (UR, $dev_line, 4096);
$dev_line =~ s/[^\w\d]//g;
$rand_line .= $dev_line;
} until (length($rand_line) >= $num_char);
close(UR);
return substr($rand_line,0, $num_char);
}
|