19package denoptim.utils;
21import static org.junit.jupiter.api.Assertions.assertNull;
22import static org.junit.jupiter.api.Assertions.assertTrue;
24import java.util.ArrayList;
27import javax.vecmath.Point3d;
29import org.junit.jupiter.api.Test;
45 double thrsld = 0.0000001;
50 double[] resA =
new double[tot];
51 for (
int i=0; i<tot; i++)
57 double[] resB =
new double[tot];
58 for (
int i=0; i<tot; i++)
63 for (
int i=0; i<tot; i++)
65 assertTrue(thrsld > Math.abs(resA[i] - resB[i]),
66 "Inconsistent sequence of random doubles");
76 double maxVal = 12.34;
77 for (
int i=0; i<10; i++)
80 assertTrue(maxVal >= Math.abs(p.x));
81 assertTrue(maxVal >= Math.abs(p.y));
82 assertTrue(maxVal >= Math.abs(p.z));
92 List<Integer> list =
new ArrayList<Integer>();
95 for (
int i=0; i<3; i++)
101 for (
int i=0; i<10; i++)
105 for (
int i=0; i<20; i++)
108 assertTrue(chosen >= 0);
109 assertTrue(chosen < 10);
Tool to generate random numbers and random decisions.
public< T > T randomlyChooseOne(Collection< T > c)
Chooses one member among the given collection.
double nextDouble()
Returns the next pseudo-random, uniformly distributed double value between 0.0 and 1....
Point3d getNoisyPoint(double maxAbsValue)
Returns a point in three-dimensional space with a random set of coordinates, the absolute value of wh...
void testRandomlyChooseOne()
void testRandomizerReproducibility()