File: 2.t

package info (click to toggle)
libmath-random-mt-perl 1.17-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 140 kB
  • sloc: ansic: 216; perl: 63; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 665 bytes parent folder | download | duplicates (2)
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
28
29
use strict;
use Test::More;
use Test::Number::Delta within => 1e-14;
BEGIN {
   use_ok('Math::Random::MT', qw(srand rand irand));
}


# Test that functional interface results are identical to that of OO interface

ok srand(5489);


delta_ok rand(), 0.814723691903055;
delta_ok rand(), 0.135477004107088;

delta_ok irand(), 3890346734;
delta_ok irand(), 3586334585;

delta_ok rand(10), 1.269868118688464, 'rand() takes a multiplier as argument';
delta_ok rand(10), 9.688677710946649;

delta_ok irand(123), 3922919429, 'irand() takes no argument'; # given argument does nothing
delta_ok irand(123),  949333985;

is srand(0), 0, '0 is a valid seed';


done_testing();