1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.rng.simple;
18
19 import org.junit.Assert;
20 import org.junit.Test;
21
22
23
24
25 public class RandomSourceTest {
26 @Test
27 public void testCreateInt() {
28 final int n = 4;
29 for (int i = 0; i < n; i++) {
30
31 Assert.assertNotEquals(RandomSource.createInt(),
32 RandomSource.createInt());
33 }
34 }
35
36 @Test
37 public void testCreateLong() {
38 final int n = 6;
39 for (int i = 0; i < n; i++) {
40
41 Assert.assertNotEquals(RandomSource.createLong(),
42 RandomSource.createLong());
43 }
44 }
45
46 @Test
47 public void testCreateIntArray() {
48 final int n = 13;
49 final int[] seed = RandomSource.createIntArray(n);
50 Assert.assertEquals(n, seed.length);
51
52 for (int i = 1; i < n; i++) {
53
54 Assert.assertNotEquals(seed[i - 1], seed[i]);
55 }
56 }
57
58 @Test
59 public void testCreateLongArray() {
60 final int n = 9;
61 final long[] seed = RandomSource.createLongArray(n);
62 Assert.assertEquals(n, seed.length);
63
64 for (int i = 1; i < n; i++) {
65
66 Assert.assertNotEquals(seed[i - 1], seed[i]);
67 }
68 }
69 }