Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
48 lines
1.7 KiB
C++
48 lines
1.7 KiB
C++
//===========================================================================//
|
|
// File: random.tst //
|
|
// Project: MUNGA Brick: Math Library //
|
|
// Contents: test function for the random number generator //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// 11/20/93 JMA Initial coding. //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1993-1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#include "StuffHeaders.hpp"
|
|
#pragma warning(disable: 4189) // disable unreferenced variable warning
|
|
|
|
bool
|
|
Random::TestClass()
|
|
{
|
|
SPEW((GROUP_STUFF_TEST, "Starting Random::Instance test..."));
|
|
|
|
#define RANDOM_TEST_COUNT 10000
|
|
|
|
int i;
|
|
for (i=0; i<RANDOM_TEST_COUNT; ++i)
|
|
{
|
|
Scalar r = Random::Instance->GetFraction();
|
|
Verify(r >= 0.0f && r < 1.0f);
|
|
}
|
|
|
|
int array[10];
|
|
for (i = 0; i<ELEMENTS(array); ++i)
|
|
{
|
|
array[i] = 0;
|
|
}
|
|
|
|
for (i = 0; i<RANDOM_TEST_COUNT; ++i)
|
|
{
|
|
int r = Random::Instance->GetLessThan(ELEMENTS(array));
|
|
Verify(r >= 0 && r < ELEMENTS(array));
|
|
++array[r];
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|