Skip to content

Instantly share code, notes, and snippets.

View adokoy001's full-sized avatar

Toshiaki_Yokoda adokoy001

View GitHub Profile
@adokoy001
adokoy001 / rarity.pl
Created June 21, 2017 10:34
Error function and Rarity calculation with Gauss distribution.
use strict;
use warnings;
use bignum (a => 200);
# error function
sub erf {
my $x = shift;
$x = $x * sqrt(2);
my $sqrt2pi = sqrt(2 * 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027);
my $t = 1.0/(1.0 + 0.2316419*abs($x));
@adokoy001
adokoy001 / gen_rand.pl
Created May 19, 2021 01:27
Random string generator
#!/usr/bin/env perl
use strict;
use warnings;
my $length = shift // 64;
my $mode = shift // 'default'; # alphabet,small,capital,number,complex
my @special_chars = ('_','-','?','=','^','[',']','{','}','&','$','#','@','!','*','~','`','%','(',')','+','|',':',';','"',"'",'<','>',',','.','/','\\');
my @small_chars = ('a' .. 'z');
my @capital_chars = ('A' .. 'Z');