]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/random.qh
Merge branch 'martin-t/units' into 'master'
[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 ERASEABLE
11 void RandomSelection_Init();
12 ERASEABLE
13 void RandomSelection_Add(entity e, float f, string s, vector v, float weight, float priority);
14 #define RandomSelection_AddEnt(e, weight, priority) RandomSelection_Add(e, 0, string_null, '0 0 0', weight, priority)
15 #define RandomSelection_AddFloat(f, weight, priority) RandomSelection_Add(NULL, f, string_null, '0 0 0', weight, priority)
16 #define RandomSelection_AddString(s, weight, priority) RandomSelection_Add(NULL, 0, s, '0 0 0', weight, priority)
17 #define RandomSelection_AddVec(v, weight, priority) RandomSelection_Add(NULL, 0, string_null, v, weight, priority)
18
19 // prandom - PREDICTABLE random number generator
20
21 #define USE_PRANDOM
22
23 #ifdef USE_PRANDOM
24         float prandom();
25         vector prandomvec();
26
27         void psrandom(float seed);
28         #ifdef USE_PRANDOM_DEBUG
29                 void prandom_debug();
30         #else
31                 #define prandom_debug()
32         #endif
33 #else
34         #define prandom random
35         #define prandomvec randomvec
36         #define psrandom(x)
37         #define prandom_debug()
38 #endif