Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IceRandom.cpp File Reference
#include "Stdafx.h"

Go to the source code of this file.

Functions

void SRand (udword seed)
 
udword Rand ()
 
udword GetRandomIndex (udword max_index)
 Returns a random index so that 0<= index < max_index. More...
 

Variables

static BasicRandom gRandomGenerator (42)
 

Detailed Description

Contains code for random generators.

Author
Pierre Terdiman
Date
August, 9, 2001

Definition in file IceRandom.cpp.

Function Documentation

udword GetRandomIndex ( udword  max_index)

Returns a random index so that 0<= index < max_index.

Definition at line 30 of file IceRandom.cpp.

References gRandomGenerator, and BasicRandom::Randomize().

31 {
32  // We don't use rand() since it's limited to RAND_MAX
34  return Index % max_index;
35 }
udword Rand ( )

Definition at line 22 of file IceRandom.cpp.

Referenced by UnitRandomFloat().

23 {
24  return rand();
25 }
void SRand ( udword  seed)

Definition at line 17 of file IceRandom.cpp.

18 {
19  srand(seed);
20 }

Variable Documentation

BasicRandom gRandomGenerator(42)
static

Referenced by GetRandomIndex().