MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Gauss

Method Gauss

engine/Random/randomGen.cpp:156–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154RandomGenerator::RandomGenerator() : _seed(Poseidon::Foundation::GlobalTickCount() + 3256), _seedTable(Poseidon::Foundation::GlobalTickCount()), _valueTable(120) {}
155
156float RandomGenerator::Gauss(float min, float mid, float max) const
157{
158 float gauss = (RandomValue() + RandomValue() + RandomValue() + RandomValue()) * 0.25;
159 float delay = 0;
160 if (gauss < 0.5)
161 {
162 float coef = gauss * 2;
163 delay = min + (mid - min) * coef;
164 }
165 else
166 {
167 float coef = gauss * 2 - 1;
168 delay = mid + (max - mid) * coef;
169 }
170 return delay;
171}
172
173float RandomGenerator::PlusMinus(float a, float b) const
174{

Callers 14

ScanMethod · 0.80
Thing.cppFile · 0.80
GetVariantAfterMethod · 0.80
DammageCrewMethod · 0.80
SimulateMethod · 0.80
SimulateMethod · 0.80
SimulateMethod · 0.80
SimulateMethod · 0.80
SimulateOneIterMethod · 0.80
SimulateMethod · 0.80
ArcadeCountdownFunction · 0.80
NextMessageMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected