Ocean
TestRandom.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_TEST_TESTMATH_TEST_RANDOM_H
9 #define META_OCEAN_TEST_TESTMATH_TEST_RANDOM_H
10 
12 
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestMath
22 {
23 
24 /**
25  * This class tests the performance of the random functionalities.
26  * @ingroup testmath
27  */
28 class OCEAN_TEST_MATH_EXPORT TestRandom
29 {
30  public:
31 
32  /**
33  * Executes the entire random tests.
34  * @param testDuration Number of seconds for each test, with range (0, infinity)
35  * @return True, if succeeded
36  */
37  static bool test(const double testDuration);
38 
39  /**
40  * Tests the performance of the standard random function using a single thread.
41  * @param testDuration Number of seconds for each test, with range (0, infinity)
42  * @return True, if succeeded
43  */
44  static bool testStandardRandomSingleThreaded(const double testDuration);
45 
46  /**
47  * Tests the performance of the standard random function using multiple threads.
48  * @param testDuration Number of seconds for each test, with range (0, infinity)
49  * @return True, if succeeded
50  */
51  static bool testStandardRandomMultiThreaded(const double testDuration);
52 
53  /**
54  * Tests the performance of the Ocean random function using a single thread.
55  * @param testDuration Number of seconds for each test, with range (0, infinity)
56  * @return True, if succeeded
57  */
58  static bool testOceanRandomSingleThreaded(const double testDuration);
59 
60  /**
61  * Tests the performance of the Ocean random function using multiple threads.
62  * @param testDuration Number of seconds for each test, with range (0, infinity)
63  * @return True, if succeeded
64  */
65  static bool testOceanRandomMultiThreaded(const double testDuration);
66 
67  /**
68  * Tests the performance of the standard triple random function.
69  * @param testDuration Number of seconds for each test, with range (0, infinity)
70  * @return True, if succeeded
71  */
72  static bool testStandardRandomTriple(const double testDuration);
73 
74  /**
75  * Tests the performance of the Ocean triple random function.
76  * @param testDuration Number of seconds for each test, with range (0, infinity)
77  * @return True, if succeeded
78  */
79  static bool testOceanRandomTriple(const double testDuration);
80 
81  /**
82  * Tests the random 3D vector with specified ranges function.
83  * @param testDuration Number of seconds for each test, with range (0, infinity)
84  * @return True, if succeeded
85  */
86  static bool testStandardRandomVector3(const double testDuration);
87 
88  /**
89  * Tests the Ocean random 3D vector with specified ranges function.
90  * @param testDuration Number of seconds for each test, with range (0, infinity)
91  * @return True, if succeeded
92  */
93  static bool testOceanRandomVector3(const double testDuration);
94 
95  /**
96  * Tests the random euler with specified range function.
97  * @param testDuration Number of seconds for each test, with range (0, infinity)
98  * @return True, if succeeded
99  */
100  static bool testStandardRandomEuler(const double testDuration);
101 
102  /**
103  * Tests the Ocean random euler with specified range function.
104  * @param testDuration Number of seconds for each test, with range (0, infinity)
105  * @return True, if succeeded
106  */
107  static bool testOceanRandomEuler(const double testDuration);
108 
109  private:
110 
111  /**
112  * Calculates random variables for a subset of the given data using the standard random function.
113  * @param values Values receiving the random values
114  * @param firstValue First value to be handled
115  * @param numberValues Number of values to be handled
116  */
117  static void calculateStandardRandomValues(int* values, const unsigned int firstValue, const unsigned int numberValues);
118 
119  /**
120  * Calculates random variables for a subset of the given data using an own implementation of the random function.
121  * @param generator Random number generator used for initialization of the local generator
122  * @param values Values receiving the random values
123  * @param firstValue First value to be handled
124  * @param numberValues Number of values to be handled
125  */
126  static void calculateOceanRandomValues(RandomGenerator* generator, int* values, const unsigned int firstValue, const unsigned int numberValues);
127 };
128 
129 }
130 
131 }
132 
133 }
134 
135 #endif // META_OCEAN_TEST_TESTMATH_TEST_RANDOM_H
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class tests the performance of the random functionalities.
Definition: TestRandom.h:29
static bool testStandardRandomVector3(const double testDuration)
Tests the random 3D vector with specified ranges function.
static bool testOceanRandomMultiThreaded(const double testDuration)
Tests the performance of the Ocean random function using multiple threads.
static bool testOceanRandomVector3(const double testDuration)
Tests the Ocean random 3D vector with specified ranges function.
static bool testOceanRandomTriple(const double testDuration)
Tests the performance of the Ocean triple random function.
static void calculateOceanRandomValues(RandomGenerator *generator, int *values, const unsigned int firstValue, const unsigned int numberValues)
Calculates random variables for a subset of the given data using an own implementation of the random ...
static bool testStandardRandomSingleThreaded(const double testDuration)
Tests the performance of the standard random function using a single thread.
static bool testOceanRandomSingleThreaded(const double testDuration)
Tests the performance of the Ocean random function using a single thread.
static void calculateStandardRandomValues(int *values, const unsigned int firstValue, const unsigned int numberValues)
Calculates random variables for a subset of the given data using the standard random function.
static bool testStandardRandomTriple(const double testDuration)
Tests the performance of the standard triple random function.
static bool testStandardRandomEuler(const double testDuration)
Tests the random euler with specified range function.
static bool test(const double testDuration)
Executes the entire random tests.
static bool testStandardRandomMultiThreaded(const double testDuration)
Tests the performance of the standard random function using multiple threads.
static bool testOceanRandomEuler(const double testDuration)
Tests the Ocean random euler with specified range function.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15