FS2_Open
Open source remastering of the Freespace 2 engine
staticrand.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _STATIC_RAND_H
13 
14 #include "globalincs/pstypes.h"
15 
16 #define SEMIRAND_MAX_LOG 4
17 #define SEMIRAND_MAX (2 << SEMIRAND_MAX_LOG) // Do not change this! Change SEMIRAND_MAX_LOG!
18 
19 extern int Semirand[SEMIRAND_MAX]; // this array is saved by the ai code on save/restore
20 
21 extern void init_semirand();
22 extern int static_rand(int num);
23 extern float static_randf(int num);
24 extern void static_randvec(int num, vec3d *vp);
25 extern int static_rand_range(int num, int min, int max);
26 extern float static_randf_range(int num, float min, float max);
27 void static_rand_cone(int num, vec3d *out, vec3d *in, float max_angle, matrix *orient = NULL);
28 
29 // Alternate random number generator that doesn't affect rand() sequence
30 
31 void init_static_rand_alt(int seed); // Seed the random number generator
32 int static_rand_alt(); // Get a random integer between 1 and RND_MAX
33 float static_randf_alt(); // Get a random float between 0 and 1.0
34 
35 #endif
#define vp(p)
Definition: modelsinc.h:70
Definition: pstypes.h:88
int Semirand[SEMIRAND_MAX]
Definition: staticrand.cpp:17
hull_check orient
Definition: lua.cpp:5049
GLuint in
Definition: Glext.h:9087
#define SEMIRAND_MAX
Definition: staticrand.h:17
void static_randvec(int num, vec3d *vp)
[To be described]
Definition: staticrand.cpp:111
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...
Definition: staticrand.cpp:129
int static_rand(int num)
Return a pseudo random 32 bit value given a reasonably small number.
Definition: staticrand.cpp:38
float static_randf(int num)
Return a random float in 0.0f .. 1.0f- (ie, it will never return 1.0f).
Definition: staticrand.cpp:61
void init_semirand()
Initialize Semirand array. Doesn't have to be called.
Definition: staticrand.cpp:22
void init_static_rand_alt(int seed)
Seed the alternative random number generator. Doesn't have to be called.
Definition: staticrand.cpp:166
GLuint GLuint num
Definition: Glext.h:9089
float static_randf_range(int num, float min, float max)
Return a random float within a range. Note: min and max are inclusive.
Definition: staticrand.cpp:95
int static_rand_alt()
Get a random integer between 1 and RND_MAX.
Definition: staticrand.cpp:176
float static_randf_alt()
Get a random integer between 0 and 1.0.
Definition: staticrand.cpp:193
int static_rand_range(int num, int min, int max)
Return a random integer within a range. Note: min and max are inclusive.
Definition: staticrand.cpp:78