MCPcopy Create free account
hub / github.com/ZDoom/Raze / NativeFRandom

Function NativeFRandom

source/common/scripting/backend/codegen.cpp:6412–6422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6410//==========================================================================
6411
6412static double NativeFRandom(FRandom *rng, double min, double max)
6413{
6414 int random = (*rng)(0x40000000);
6415 double frandom = random / double(0x40000000);
6416
6417 if (max < min)
6418 {
6419 std::swap(max, min);
6420 }
6421 return frandom * (max - min) + min;
6422}
6423
6424DEFINE_ACTION_FUNCTION_NATIVE(DObject, BuiltinFRandom, NativeFRandom)
6425{

Callers 1

Calls 1

swapFunction · 0.85

Tested by

no test coverage detected