src/core/random_func.hpp
changeset 8431 68fb2ccbce06
child 8432 e4bee6adc9f9
equal deleted inserted replaced
8430:9f32cec597ed 8431:68fb2ccbce06
       
     1 /* $Id$ */
       
     2 
       
     3 /** @file random_func.h */
       
     4 
       
     5 #ifndef RANDOM_FUNC_HPP
       
     6 #define RANDOM_FUNC_HPP
       
     7 
       
     8 /**************
       
     9  * Warning: DO NOT enable this unless you understand what it does
       
    10  *
       
    11  * If enabled, in a network game all randoms will be dumped to the
       
    12  *  stdout if the first client joins (or if you are a client). This
       
    13  *  is to help finding desync problems.
       
    14  *
       
    15  * Warning: DO NOT enable this unless you understand what it does
       
    16  **************/
       
    17 
       
    18 //#define RANDOM_DEBUG
       
    19 
       
    20 
       
    21 // Enable this to produce higher quality random numbers.
       
    22 // Doesn't work with network yet.
       
    23 // #define MERSENNE_TWISTER
       
    24 
       
    25 void SetRandomSeed(uint32 seed);
       
    26 #ifdef RANDOM_DEBUG
       
    27 	#define Random() DoRandom(__LINE__, __FILE__)
       
    28 	uint32 DoRandom(int line, const char *file);
       
    29 	#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
       
    30 	uint DoRandomRange(uint max, int line, const char *file);
       
    31 #else
       
    32 	uint32 Random();
       
    33 	uint RandomRange(uint max);
       
    34 #endif
       
    35 
       
    36 uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
       
    37 uint InteractiveRandomRange(uint max);
       
    38 
       
    39 #endif /* RANDOM_FUNC_HPP */
       
    40 /* $Id$ */
       
    41 
       
    42 /** @file random_func.h */
       
    43 
       
    44 #ifndef RANDOM_FUNC_HPP
       
    45 #define RANDOM_FUNC_HPP
       
    46 
       
    47 /**************
       
    48  * Warning: DO NOT enable this unless you understand what it does
       
    49  *
       
    50  * If enabled, in a network game all randoms will be dumped to the
       
    51  *  stdout if the first client joins (or if you are a client). This
       
    52  *  is to help finding desync problems.
       
    53  *
       
    54  * Warning: DO NOT enable this unless you understand what it does
       
    55  **************/
       
    56 
       
    57 //#define RANDOM_DEBUG
       
    58 
       
    59 
       
    60 // Enable this to produce higher quality random numbers.
       
    61 // Doesn't work with network yet.
       
    62 // #define MERSENNE_TWISTER
       
    63 
       
    64 void SetRandomSeed(uint32 seed);
       
    65 #ifdef RANDOM_DEBUG
       
    66 	#define Random() DoRandom(__LINE__, __FILE__)
       
    67 	uint32 DoRandom(int line, const char *file);
       
    68 	#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
       
    69 	uint DoRandomRange(uint max, int line, const char *file);
       
    70 #else
       
    71 	uint32 Random();
       
    72 	uint RandomRange(uint max);
       
    73 #endif
       
    74 
       
    75 uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
       
    76 uint InteractiveRandomRange(uint max);
       
    77 
       
    78 #endif /* RANDOM_FUNC_HPP */
       
    79 /* $Id$ */
       
    80 
       
    81 /** @file random_func.h */
       
    82 
       
    83 #ifndef RANDOM_FUNC_HPP
       
    84 #define RANDOM_FUNC_HPP
       
    85 
       
    86 /**************
       
    87  * Warning: DO NOT enable this unless you understand what it does
       
    88  *
       
    89  * If enabled, in a network game all randoms will be dumped to the
       
    90  *  stdout if the first client joins (or if you are a client). This
       
    91  *  is to help finding desync problems.
       
    92  *
       
    93  * Warning: DO NOT enable this unless you understand what it does
       
    94  **************/
       
    95 
       
    96 //#define RANDOM_DEBUG
       
    97 
       
    98 
       
    99 // Enable this to produce higher quality random numbers.
       
   100 // Doesn't work with network yet.
       
   101 // #define MERSENNE_TWISTER
       
   102 
       
   103 void SetRandomSeed(uint32 seed);
       
   104 #ifdef RANDOM_DEBUG
       
   105 	#define Random() DoRandom(__LINE__, __FILE__)
       
   106 	uint32 DoRandom(int line, const char *file);
       
   107 	#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
       
   108 	uint DoRandomRange(uint max, int line, const char *file);
       
   109 #else
       
   110 	uint32 Random();
       
   111 	uint RandomRange(uint max);
       
   112 #endif
       
   113 
       
   114 uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
       
   115 uint InteractiveRandomRange(uint max);
       
   116 
       
   117 #endif /* RANDOM_FUNC_HPP */
       
   118 /* $Id$ */
       
   119 
       
   120 /** @file random_func.h */
       
   121 
       
   122 #ifndef RANDOM_FUNC_HPP
       
   123 #define RANDOM_FUNC_HPP
       
   124 
       
   125 /**************
       
   126  * Warning: DO NOT enable this unless you understand what it does
       
   127  *
       
   128  * If enabled, in a network game all randoms will be dumped to the
       
   129  *  stdout if the first client joins (or if you are a client). This
       
   130  *  is to help finding desync problems.
       
   131  *
       
   132  * Warning: DO NOT enable this unless you understand what it does
       
   133  **************/
       
   134 
       
   135 //#define RANDOM_DEBUG
       
   136 
       
   137 
       
   138 // Enable this to produce higher quality random numbers.
       
   139 // Doesn't work with network yet.
       
   140 // #define MERSENNE_TWISTER
       
   141 
       
   142 void SetRandomSeed(uint32 seed);
       
   143 #ifdef RANDOM_DEBUG
       
   144 	#define Random() DoRandom(__LINE__, __FILE__)
       
   145 	uint32 DoRandom(int line, const char *file);
       
   146 	#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
       
   147 	uint DoRandomRange(uint max, int line, const char *file);
       
   148 #else
       
   149 	uint32 Random();
       
   150 	uint RandomRange(uint max);
       
   151 #endif
       
   152 
       
   153 uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
       
   154 uint InteractiveRandomRange(uint max);
       
   155 
       
   156 #endif /* RANDOM_FUNC_HPP */
       
   157 /* $Id$ */
       
   158 
       
   159 /** @file random_func.h */
       
   160 
       
   161 #ifndef RANDOM_FUNC_HPP
       
   162 #define RANDOM_FUNC_HPP
       
   163 
       
   164 /**************
       
   165  * Warning: DO NOT enable this unless you understand what it does
       
   166  *
       
   167  * If enabled, in a network game all randoms will be dumped to the
       
   168  *  stdout if the first client joins (or if you are a client). This
       
   169  *  is to help finding desync problems.
       
   170  *
       
   171  * Warning: DO NOT enable this unless you understand what it does
       
   172  **************/
       
   173 
       
   174 //#define RANDOM_DEBUG
       
   175 
       
   176 
       
   177 // Enable this to produce higher quality random numbers.
       
   178 // Doesn't work with network yet.
       
   179 // #define MERSENNE_TWISTER
       
   180 
       
   181 void SetRandomSeed(uint32 seed);
       
   182 #ifdef RANDOM_DEBUG
       
   183 	#define Random() DoRandom(__LINE__, __FILE__)
       
   184 	uint32 DoRandom(int line, const char *file);
       
   185 	#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
       
   186 	uint DoRandomRange(uint max, int line, const char *file);
       
   187 #else
       
   188 	uint32 Random();
       
   189 	uint RandomRange(uint max);
       
   190 #endif
       
   191 
       
   192 uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
       
   193 uint InteractiveRandomRange(uint max);
       
   194 
       
   195 #endif /* RANDOM_FUNC_HPP */
       
   196 /* $Id$ */
       
   197 
       
   198 /** @file random_func.h */
       
   199 
       
   200 #ifndef RANDOM_FUNC_HPP
       
   201 #define RANDOM_FUNC_HPP
       
   202 
       
   203 /**************
       
   204  * Warning: DO NOT enable this unless you understand what it does
       
   205  *
       
   206  * If enabled, in a network game all randoms will be dumped to the
       
   207  *  stdout if the first client joins (or if you are a client). This
       
   208  *  is to help finding desync problems.
       
   209  *
       
   210  * Warning: DO NOT enable this unless you understand what it does
       
   211  **************/
       
   212 
       
   213 //#define RANDOM_DEBUG
       
   214 
       
   215 
       
   216 // Enable this to produce higher quality random numbers.
       
   217 // Doesn't work with network yet.
       
   218 // #define MERSENNE_TWISTER
       
   219 
       
   220 void SetRandomSeed(uint32 seed);
       
   221 #ifdef RANDOM_DEBUG
       
   222 	#define Random() DoRandom(__LINE__, __FILE__)
       
   223 	uint32 DoRandom(int line, const char *file);
       
   224 	#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
       
   225 	uint DoRandomRange(uint max, int line, const char *file);
       
   226 #else
       
   227 	uint32 Random();
       
   228 	uint RandomRange(uint max);
       
   229 #endif
       
   230 
       
   231 uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
       
   232 uint InteractiveRandomRange(uint max);
       
   233 
       
   234 #endif /* RANDOM_FUNC_HPP */