FS2_Open
Open source remastering of the Freespace 2 engine
staticrand.h File Reference

Go to the source code of this file.

Macros

#define SEMIRAND_MAX_LOG   4
 
#define SEMIRAND_MAX   (2 << SEMIRAND_MAX_LOG)
 

Functions

void init_semirand ()
 Initialize Semirand array. Doesn't have to be called. More...
 
int static_rand (int num)
 Return a pseudo random 32 bit value given a reasonably small number. More...
 
float static_randf (int num)
 Return a random float in 0.0f .. 1.0f- (ie, it will never return 1.0f). More...
 
void static_randvec (int num, vec3d *vp)
 [To be described] More...
 
int static_rand_range (int num, int min, int max)
 Return a random integer within a range. Note: min and max are inclusive. More...
 
float static_randf_range (int num, float min, float max)
 Return a random float within a range. Note: min and max are inclusive. More...
 
void static_rand_cone (int num, vec3d *out, vec3d *in, float max_angle, matrix *orient=NULL)
 Randomly perturb a vector around a given (normalized vector) or optional orientation matrix. More...
 
void init_static_rand_alt (int seed)
 Seed the alternative random number generator. Doesn't have to be called. More...
 
int static_rand_alt ()
 Get a random integer between 1 and RND_MAX. More...
 
float static_randf_alt ()
 Get a random integer between 0 and 1.0. More...
 

Variables

int Semirand [SEMIRAND_MAX]
 

Macro Definition Documentation

#define SEMIRAND_MAX   (2 << SEMIRAND_MAX_LOG)

Definition at line 17 of file staticrand.h.

#define SEMIRAND_MAX_LOG   4

Definition at line 16 of file staticrand.h.

Function Documentation

void init_semirand ( )

Initialize Semirand array. Doesn't have to be called.

Definition at line 22 of file staticrand.cpp.

void init_static_rand_alt ( int  seed)

Seed the alternative random number generator. Doesn't have to be called.

Parameters
seedSeed input number

Definition at line 166 of file staticrand.cpp.

int static_rand ( int  num)

Return a pseudo random 32 bit value given a reasonably small number.

Parameters
numSeed input number
Returns
Pseudo random 32 bit value

Definition at line 38 of file staticrand.cpp.

int static_rand_alt ( )

Get a random integer between 1 and RND_MAX.

Returns
Random integer between 1 and RND_MAX

Definition at line 176 of file staticrand.cpp.

void static_rand_cone ( int  num,
vec3d out,
vec3d in,
float  max_angle,
matrix orient 
)

Randomly perturb a vector around a given (normalized vector) or optional orientation matrix.

Parameters
num
out
in
max_angle
orient

Definition at line 129 of file staticrand.cpp.

int static_rand_range ( int  num,
int  min,
int  max 
)

Return a random integer within a range. Note: min and max are inclusive.

Parameters
numSeed input number
minMinimum range integer to return
maxMaximum range integer to return
Returns
Random integer within the range

Definition at line 78 of file staticrand.cpp.

float static_randf ( int  num)

Return a random float in 0.0f .. 1.0f- (ie, it will never return 1.0f).

Parameters
numSeed input number
Returns
Random value in 0.0f .. 1.0f- (ie, it will never return 1.0f).

Definition at line 61 of file staticrand.cpp.

float static_randf_alt ( )

Get a random integer between 0 and 1.0.

Returns
Random float between 0 and 1.0

Definition at line 193 of file staticrand.cpp.

float static_randf_range ( int  num,
float  min,
float  max 
)

Return a random float within a range. Note: min and max are inclusive.

Parameters
numSeed input number
minMinimum range float to return
maxMaximum range float to return
Returns
Random float within the range

Definition at line 95 of file staticrand.cpp.

void static_randvec ( int  num,
vec3d vp 
)

[To be described]

Parameters
numSeed input number
vpVector

Definition at line 111 of file staticrand.cpp.

Variable Documentation

int Semirand[SEMIRAND_MAX]

Definition at line 17 of file staticrand.cpp.