diff --git a/MarkovBot.pl b/MarkovBot.pl index 4c55f38..8a67915 100644 --- a/MarkovBot.pl +++ b/MarkovBot.pl @@ -16,6 +16,7 @@ use MarkovBot::Commands; use MarkovBot::MarkovChain; use MarkovBot::Redis; use Encode qw(encode decode); +use if (config("rng") eq "mt"), "Math::Random::MT::Perl" => qw(rand); sub said { my $self = shift; diff --git a/MarkovBot/MarkovChain.pm b/MarkovBot/MarkovChain.pm index 8ea6225..fdf3ddb 100644 --- a/MarkovBot/MarkovChain.pm +++ b/MarkovBot/MarkovChain.pm @@ -12,6 +12,7 @@ use lib $Bin; use MarkovBot::Config; use MarkovBot::Redis; use Encode qw(decode encode); +use if (config("rng") eq "mt"), "Math::Random::MT::Perl" => qw(rand); sub markov( $ ) { # markov - given two starting words, returns a markov chain result diff --git a/config.default.yml b/config.default.yml index 4887c5b..e9dbd6f 100644 --- a/config.default.yml +++ b/config.default.yml @@ -21,3 +21,10 @@ irc_port: 6697 irc_channel: "#baz" irc_nickname: shithead-ng irc_nickname2: shithead + +# +# RNG to use +# This can be "rand" for perl's built in rand() function +# Or "mt" to use the Math::Random::MT::Perl module (recommended) +# +rng: rand diff --git a/cpanfile b/cpanfile index 6fd8e7b..62ed3b5 100644 --- a/cpanfile +++ b/cpanfile @@ -6,3 +6,6 @@ requires "YAML::Tiny" => "0"; requires "POE::Component::SSLify" => "0"; requires "Scalar::Util" => "0"; requires "Encode" => "0"; +requires "if" => "0"; + +recommends "Math::Random::MT::Perl" => "0";