Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
GameLogicRandomVariable Class Reference

#include <LogicRandomValue.h>

Public Types

enum  DistributionType {
  CONSTANT , UNIFORM , GAUSSIAN , TRIANGULAR ,
  LOW_BIAS , HIGH_BIAS
}
 

Public Member Functions

void setRange (Real low, Real high, DistributionType type=UNIFORM)
 define the range of random values, and the distribution of values
 
Real getValue (void) const
 return a value from the random distribution
 
Real getMinimumValue (void) const
 
Real getMaximumValue (void) const
 
DistributionType getDistributionType (void) const
 

Static Public Attributes

static const char * DistributionTypeNames []
 

Protected Attributes

DistributionType m_type
 the kind of random distribution
 
Real m_low
 
Real m_high
 the range of random values
 
friend CColorAlphaDialog
 
friend DebugWindowDialog
 

Detailed Description

A GameLogicRandomVariable represents a distribution of random values from which discrete values can be retrieved.

Definition at line 53 of file LogicRandomValue.h.

Member Enumeration Documentation

◆ DistributionType

CONSTANT represents a single, constant, value. UNIFORM represents a uniform distribution of random values. GAUSSIAN represents a normally distributed set of random values. TRIANGULAR represents a distribution of random values in the shape of a triangle, with the peak probability midway between low and high. LOW_BIAS represents a distribution of random values with maximum probability at low, and zero probability at high. HIGH_BIAS represents a distribution of random values with zero probability at low, and maximum probability at high.

Enumerator
CONSTANT 
UNIFORM 
GAUSSIAN 
TRIANGULAR 
LOW_BIAS 
HIGH_BIAS 

Definition at line 69 of file LogicRandomValue.h.

Member Function Documentation

◆ getDistributionType()

DistributionType GameLogicRandomVariable::getDistributionType ( void ) const
inline

Definition at line 82 of file LogicRandomValue.h.

◆ getMaximumValue()

Real GameLogicRandomVariable::getMaximumValue ( void ) const
inline

Definition at line 81 of file LogicRandomValue.h.

◆ getMinimumValue()

Real GameLogicRandomVariable::getMinimumValue ( void ) const
inline

Definition at line 80 of file LogicRandomValue.h.

◆ getValue()

Real GameLogicRandomVariable::getValue ( void ) const

return a value from the random distribution

Return a value from the random distribution

Todo
fill in support for nonuniform GameLogicRandomVariables.

Definition at line 421 of file RandomValue.cpp.

◆ setRange()

void GameLogicRandomVariable::setRange ( Real low,
Real high,
DistributionType type = UNIFORM )

define the range of random values, and the distribution of values

define the range of random values, and the distribution of values

Definition at line 410 of file RandomValue.cpp.

Member Data Documentation

◆ CColorAlphaDialog

friend GameLogicRandomVariable::CColorAlphaDialog
protected

Definition at line 88 of file LogicRandomValue.h.

◆ DebugWindowDialog

friend GameLogicRandomVariable::DebugWindowDialog
protected

Definition at line 89 of file LogicRandomValue.h.

◆ DistributionTypeNames

const char * GameLogicRandomVariable::DistributionTypeNames
static
Initial value:
=
{
"CONSTANT", "UNIFORM", "GAUSSIAN", "TRIANGULAR", "LOW_BIAS", "HIGH_BIAS"
}

Definition at line 402 of file LogicRandomValue.h.

◆ m_high

Real GameLogicRandomVariable::m_high
protected

the range of random values

Definition at line 85 of file LogicRandomValue.h.

◆ m_low

Real GameLogicRandomVariable::m_low
protected

Definition at line 85 of file LogicRandomValue.h.

◆ m_type

DistributionType GameLogicRandomVariable::m_type
protected

the kind of random distribution

Definition at line 84 of file LogicRandomValue.h.


The documentation for this class was generated from the following files: