Randomizer Struct Reference

Structure to encapsulate the pseudo random number generators. More...

#include <random_func.hpp>

Public Member Functions

uint32 Next ()
 Generate the next pseudo random number.
uint32 Next (uint32 max)
 Generate the next pseudo random number scaled to max.
void SetSeed (uint32 seed)
 (Re)set the state of the random number generator.

Data Fields

uint32 state [2]
 The state of the randomizer.

Detailed Description

Structure to encapsulate the pseudo random number generators.

Definition at line 36 of file random_func.hpp.


Member Function Documentation

uint32 Randomizer::Next ( uint32  max  ) 

Generate the next pseudo random number scaled to max.

Parameters:
max the maximum value of the returned random number
Returns:
the random number

Definition at line 36 of file random_func.cpp.

References Next().

uint32 Randomizer::Next (  ) 

Generate the next pseudo random number.

Returns:
the random number

Definition at line 22 of file random_func.cpp.

References ROR(), and state.

Referenced by CmdBuildIndustry(), and Next().

void Randomizer::SetSeed ( uint32  seed  ) 

(Re)set the state of the random number generator.

Parameters:
seed the new state

Definition at line 45 of file random_func.cpp.

References state.

Referenced by _GenerateWorld(), CmdBuildIndustry(), and SetRandomSeed().


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

Generated on Wed Apr 13 00:48:54 2011 for OpenTTD by  doxygen 1.6.1