File: 60-seeding.t

package info (click to toggle)
libmath-random-oo-perl 0.22-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 216 kB
  • sloc: perl: 671; makefile: 2
file content (27 lines) | stat: -rwxr-xr-x 566 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl
use strict;
use warnings;
use blib;  

# Math::Random::OO  

use Test::More 'no_plan';

my @classes = qw(Uniform UniformInt Normal); 
my @seeds = qw/ 0 1 2 3 /;

for my $c (@classes) {
  $c = "Math::Random::OO::$c";
  require_ok( $c );
  my $rng = $c->new();
  my @rands;
  for my $s ( @seeds ) {
    $rng->seed($s);
    push @rands, [ $s, [map { $rng->next } 1 .. 5] ];
  }
  while ( my $first = shift @rands ) {
    for my $r ( @rands ) {
      ok( ! eq_array( $first->[1], $r->[1] ), "$c\: contents differ ($first->[0] vs $r->[0])" );
    }
  }
}