Archival snapshot of the Virtual World Entertainment Tesla cockpit software, 1994-1996: MUNGA engine and L4 pod layer source (Borland C++ 5.0), BT/RP game code, and game content (models, audio, maps, gauges, Division renderer data). Includes third-party libraries: Division dVS/DPL graphics, HMI SOS audio, WATTCP networking. Files are preserved byte-for-byte (.gitattributes disables all line-ending conversion). README.md documents the layout, target hardware, and toolchain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
//===========================================================================//
|
|
// File: random.cc //
|
|
// Project: MUNGA Brick: Math Library //
|
|
// Contents: Interface specification 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 //
|
|
//===========================================================================//
|
|
|
|
#if !defined(RANDOM_HPP)
|
|
# define RANDOM_HPP
|
|
|
|
# if !defined(SCALAR_HPP)
|
|
# include <scalar.hpp>
|
|
# endif
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Random ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class RandomGenerator SIGNATURED
|
|
{
|
|
private:
|
|
static int
|
|
Numbers[250]; // the random number table
|
|
static int
|
|
Index; // the current entry within the table
|
|
|
|
static void
|
|
Init();
|
|
|
|
static int
|
|
GetRandomInt();
|
|
|
|
public:
|
|
RandomGenerator()
|
|
{if (Index == -1) Init();}
|
|
|
|
//
|
|
//------------------------
|
|
// Random number functions
|
|
//------------------------
|
|
//
|
|
int
|
|
GetInt() // returns 0 .. RAND_MAX
|
|
{return GetRandomInt();}
|
|
operator Scalar(); // returns 0.0f <= x < 1.0f
|
|
int // returns 0 .. Range-1
|
|
operator ()(int Range);
|
|
|
|
static Logical
|
|
TestClass();
|
|
};
|
|
|
|
extern RandomGenerator Random;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Die ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class Die SIGNATURED
|
|
{
|
|
private:
|
|
int
|
|
highestRandom, // the highest random number giving a uniform dist.
|
|
dieSides; // the number of sides on the die (starting from 1)
|
|
|
|
public:
|
|
Die(int sides);
|
|
operator int(); // returns 1 .. dieSides
|
|
};
|
|
|
|
#endif
|