1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.rng.sampling.distribution;
18
19 import org.apache.commons.rng.RestorableUniformRandomProvider;
20 import org.apache.commons.rng.simple.RandomSource;
21 import org.junit.Test;
22
23
24
25
26 public class BoxMullerLogNormalSamplerTest {
27
28
29
30 @Test(expected = IllegalArgumentException.class)
31 public void testConstructorThrowsWithNegativeScale() {
32 final RestorableUniformRandomProvider rng =
33 RandomSource.create(RandomSource.SPLIT_MIX_64);
34 final double scale = -1e-6;
35 final double shape = 1;
36 @SuppressWarnings("unused")
37 final BoxMullerLogNormalSampler sampler =
38 new BoxMullerLogNormalSampler(rng, scale, shape);
39 }
40
41
42
43
44 @Test(expected = IllegalArgumentException.class)
45 public void testConstructorThrowsWithZeroShape() {
46 final RestorableUniformRandomProvider rng =
47 RandomSource.create(RandomSource.SPLIT_MIX_64);
48 final double scale = 1;
49 final double shape = 0;
50 @SuppressWarnings("unused")
51 final BoxMullerLogNormalSampler sampler =
52 new BoxMullerLogNormalSampler(rng, scale, shape);
53 }
54 }