Skip to content

Commit

Permalink
Move some tools to use new random module
Browse files Browse the repository at this point in the history
  • Loading branch information
rikardn committed Nov 23, 2023
1 parent 05823d3 commit b7805fa
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/mimp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Config;
use strict;
use Getopt::Long;
# External modules #
use Math::Random;
use random;
# PsN includes #
use PsN;
use common_options;
Expand Down
2 changes: 1 addition & 1 deletion bin/xv_scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use lib "$Bin/../lib";
# Everything above this line will be replaced #

use PsN;
use Math::Random;
use random;
use strict;
use Getopt::Long;
use Cwd;
Expand Down
12 changes: 11 additions & 1 deletion lib/random.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use Exporter qw(import);
use PsN;

our @EXPORT = qw(random_set_seed_from_phrase random_uniform_integer);
our @EXPORT = qw(random_set_seed_from_phrase random_uniform_integer random_permuted_index);

our $old;

Expand Down Expand Up @@ -37,4 +37,14 @@ sub random_uniform_integer
}


sub random_permuted_index
{
if ($old) {
return Math::Random::random_permuted_index(@_);
} else {
return Math::Random::Free::random_permuted_index(@_);
}
}


1;
2 changes: 1 addition & 1 deletion lib/tool/gls.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package tool::gls;

use include_modules;
use tool::modelfit;
use Math::Random;
use random;
use Config;
use Mouse;
use MouseX::Params::Validate;
Expand Down
2 changes: 1 addition & 1 deletion lib/tool/mcmp.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tool::mcmp;

use include_modules;
use Math::Random;
use random;
use strict;
use tool::modelfit;
use model;
Expand Down
2 changes: 1 addition & 1 deletion lib/tool/nonpb.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tool::nonpb;

use include_modules;
use Math::Random;
use random;
use strict;
use tool::modelfit;
use tool::pind;
Expand Down
2 changes: 1 addition & 1 deletion lib/tool/npc.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tool::npc;

use include_modules;
use Math::Random;
use random;
use strict;
use tool::modelfit;
use model;
Expand Down
2 changes: 1 addition & 1 deletion lib/tool/pvar.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tool::pvar;

use include_modules;
use Math::Random;
use random;
use File::Spec;
use Mouse;
use MouseX::Params::Validate;
Expand Down
2 changes: 1 addition & 1 deletion lib/tool/qa.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tool::qa;

use strict;
use Math::Random;
use random;
use Mouse;
use MouseX::Params::Validate;
use File::Copy 'cp';
Expand Down

0 comments on commit b7805fa

Please sign in to comment.