MCPcopy Create free account
hub / github.com/Hopson97/HopsonCraft / noiseTest

Function noiseTest

Source/Main.cpp:29–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace
28{
29 void noiseTest(int trials)
30 {
31 Random::init();
32 Noise::Generator m_noiseGen;
33 m_noiseGen.setSeed(Random::intInRange(0, 999999));
34 m_noiseGen.setNoiseFunction({5, 500, 0.4, 5000});
35
36 float total = 0;
37 std::vector<double> test;
38 for (int i = 0 ; i < trials ; i++)
39 {
40 float h = m_noiseGen.getValue(i, i, i, i);
41 test.push_back(h);
42 total += h;
43 }
44
45 std::cout << "MIN: " << *std::min_element(test.begin(), test.end()) << "\n";
46 std::cout << "MAX: " << *std::max_element(test.begin(), test.end()) << "\n";
47 std::cout << "AVG: " << total / trials << std::endl;
48 }
49
50 void errorMessage(const std::string& message)
51 {

Callers

nothing calls this directly

Calls 5

intInRangeFunction · 0.85
setNoiseFunctionMethod · 0.80
getValueMethod · 0.80
initFunction · 0.70
setSeedMethod · 0.45

Tested by

no test coverage detected