14 #include "../../include/ecl/time/random_number_generator.hpp" 26 std::cout << std::endl;
27 std::cout <<
"***********************************************************" << std::endl;
28 std::cout <<
" Uniform Numbers" << std::endl;
29 std::cout <<
"***********************************************************" << std::endl;
30 std::cout << std::endl;
32 std::cout <<
"Default (0, 1):" << std::endl;
33 for (
int i = 0; i < n; ++i)
35 std::cout <<
" " << random_number_generator.
uniform();
37 std::cout << std::endl;
38 for (
int i = 0; i < n; ++i)
40 std::cout <<
" " << random_number_generator.
uniform();
42 std::cout << std::endl;
43 std::cout <<
"Over Range (-5, 5): " << std::endl;
44 for (
int i = 0; i < n; ++i)
46 std::cout <<
" " << random_number_generator.
uniform(5.0);
48 std::cout << std::endl;
49 for (
int i = 0; i < n; ++i)
51 std::cout <<
" " << random_number_generator.
uniform(5.0);
53 std::cout << std::endl;
55 std::cout << std::endl;
56 std::cout <<
"***********************************************************" << std::endl;
57 std::cout <<
" Guassian" << std::endl;
58 std::cout <<
"***********************************************************" << std::endl;
59 std::cout << std::endl;
61 std::cout <<
"std = 1, avg = 0: " << std::endl;
62 for (
int i = 0; i < n; ++i)
64 std::cout <<
" " << random_number_generator.
gaussian(1.0);
66 std::cout << std::endl;
67 for (
int i = 0; i < n; ++i)
69 std::cout <<
" " << random_number_generator.
gaussian(1.0);
71 std::cout << std::endl;
73 std::cout <<
"std = 1, avg = 3: " << std::endl;
74 for (
int i = 0; i < n; ++i)
76 std::cout <<
" " << random_number_generator.
gaussian(1.0, 3.0);
78 std::cout << std::endl;
79 for (
int i = 0; i < n; ++i)
81 std::cout <<
" " << random_number_generator.
gaussian(1.0, 3.0);
83 std::cout << std::endl;
85 std::cout <<
"std = 3, avg = 5: " << std::endl;
86 for (
int i = 0; i < n; ++i)
88 std::cout <<
" " << random_number_generator.
gaussian(3.0, 5.0);
90 std::cout << std::endl;
91 for (
int i = 0; i < n; ++i)
93 std::cout <<
" " << random_number_generator.
gaussian(3.0, 5.0);
95 std::cout << std::endl;
97 std::cout << std::endl;
98 std::cout <<
"***********************************************************" << std::endl;
99 std::cout <<
" Passed" << std::endl;
100 std::cout <<
"***********************************************************" << std::endl;
101 std::cout << std::endl;
A random number generator.
T uniform(const T &range)
T gaussian(const T &std, const T &mu=0)