Skip to content

Commit

Permalink
allow shortcut PDL::GSL::RNG->new(..)->set_seed(..)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmx authored and devel-chm committed Apr 23, 2016
1 parent 1477036 commit bf9dd9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Lib/GSL/RNG/gsl_random.pd
Expand Up @@ -76,6 +76,8 @@ Usage:
=for usage

$rng->set_seed($integer);
# or
$rng = PDL::GSL::RNG->new('taus')->set_seed($integer);

Example:

Expand Down Expand Up @@ -1816,8 +1818,9 @@ void
set_seed(rng, seed)
gsl_rng * rng
int seed
CODE:
PPCODE:
gsl_rng_set(rng,seed);
XPUSHs(ST(0)); /* return self */

unsigned int
min(rng)
Expand Down
5 changes: 4 additions & 1 deletion t/gsl_rng.t
Expand Up @@ -16,7 +16,7 @@ BEGIN
if ( $PDL::Config{WITH_GSL} ) {
eval " use PDL::GSL::RNG; ";
unless ($@) {
plan tests => 18;
plan tests => 19;
} else {
plan skip_all => "PDL::GSL::RNG not installed.";
}
Expand All @@ -40,6 +40,9 @@ $rng->set_seed(666);

ok(1,'set_seed(); function');

my $rng2 = PDL::GSL::RNG->new('taus')->set_seed(666);
is(ref $rng2, 'PDL::GSL::RNG', 'PDL::GSL::RNG->new(..)->set_seed(..)');

# min() function Test:
$min = $rng->min(); $max = $rng->max();

Expand Down

0 comments on commit bf9dd9c

Please sign in to comment.