]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/random.qh
b2fc53f0cac4edaaa3ef964c25b7b6093ac2ae2c
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / random.qh
1 #pragma once
2
3 float RandomSelection_totalweight;
4 float RandomSelection_best_priority;
5 entity RandomSelection_chosen_ent;
6 float RandomSelection_chosen_float;
7 string RandomSelection_chosen_string;
8 vector RandomSelection_chosen_vec;
9
10 void RandomSelection_Init();
11 void RandomSelection_Add(entity e, float f, string s, vector v, float weight, float priority);
12 #define RandomSelection_AddEnt(e, weight, priority) RandomSelection_Add(e, 0, string_null, '0 0 0', weight, priority)
13 #define RandomSelection_AddFloat(f, weight, priority) RandomSelection_Add(NULL, f, string_null, '0 0 0', weight, priority)
14 #define RandomSelection_AddString(s, weight, priority) RandomSelection_Add(NULL, 0, s, '0 0 0', weight, priority)
15 #define RandomSelection_AddVec(v, weight, priority) RandomSelection_Add(NULL, 0, string_null, v, weight, priority)
16
17 // prandom - PREDICTABLE random number generator
18
19 #define USE_PRANDOM
20
21 #ifdef USE_PRANDOM
22         float prandom();
23         vector prandomvec();
24
25         void psrandom(float seed);
26         #ifdef USE_PRANDOM_DEBUG
27                 void prandom_debug();
28         #else
29                 #define prandom_debug()
30         #endif
31 #else
32         #define prandom random
33         #define prandomvec randomvec
34         #define psrandom(x)
35         #define prandom_debug()
36 #endif