1 |
/** |
2 |
* @file dSFMT.h |
3 |
* |
4 |
* @brief double precision SIMD oriented Fast Mersenne Twister(dSFMT) |
5 |
* pseudorandom number generator based on IEEE 754 format. |
6 |
* |
7 |
* @author Mutsuo Saito (Hiroshima University) |
8 |
* @author Makoto Matsumoto (Hiroshima University) |
9 |
* |
10 |
* Copyright (C) 2007, 2008 Mutsuo Saito, Makoto Matsumoto and |
11 |
* Hiroshima University. All rights reserved. |
12 |
* |
13 |
* The new BSD License is applied to this software. |
14 |
* see LICENSE.txt |
15 |
* |
16 |
* @note We assume that your system has inttypes.h. If your system |
17 |
* doesn't have inttypes.h, you have to typedef uint32_t and uint64_t, |
18 |
* and you have to define PRIu64 and PRIx64 in this file as follows: |
19 |
* @verbatim |
20 |
typedef unsigned int uint32_t |
21 |
typedef unsigned long long uint64_t |
22 |
#define PRIu64 "llu" |
23 |
#define PRIx64 "llx" |
24 |
@endverbatim |
25 |
* uint32_t must be exactly 32-bit unsigned integer type (no more, no |
26 |
* less), and uint64_t must be exactly 64-bit unsigned integer type. |
27 |
* PRIu64 and PRIx64 are used for printf function to print 64-bit |
28 |
* unsigned int and 64-bit unsigned int in hexadecimal format. |
29 |
*/ |
30 |
|
31 |
#ifndef DSFMT_H |
32 |
#define DSFMT_H |
33 |
|
34 |
#include <stdio.h> |
35 |
#include <assert.h> |
36 |
|
37 |
#if !defined(DSFMT_MEXP) |
38 |
#ifdef __GNUC__ |
39 |
#warning "DSFMT_MEXP is not defined. I assume DSFMT_MEXP is 19937." |
40 |
#endif |
41 |
#define DSFMT_MEXP 19937 |
42 |
#endif |
43 |
/*----------------- |
44 |
BASIC DEFINITIONS |
45 |
-----------------*/ |
46 |
/* Mersenne Exponent. The period of the sequence |
47 |
* is a multiple of 2^DSFMT_MEXP-1. |
48 |
* #define DSFMT_MEXP 19937 */ |
49 |
/** DSFMT generator has an internal state array of 128-bit integers, |
50 |
* and N is its size. */ |
51 |
#define DSFMT_N ((DSFMT_MEXP - 128) / 104 + 1) |
52 |
/** N32 is the size of internal state array when regarded as an array |
53 |
* of 32-bit integers.*/ |
54 |
#define DSFMT_N32 (DSFMT_N * 4) |
55 |
/** N64 is the size of internal state array when regarded as an array |
56 |
* of 64-bit integers.*/ |
57 |
#define DSFMT_N64 (DSFMT_N * 2) |
58 |
|
59 |
#if !defined(DSFMT_BIG_ENDIAN) |
60 |
# if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) |
61 |
# if __BYTE_ORDER == __BIG_ENDIAN |
62 |
# define DSFMT_BIG_ENDIAN 1 |
63 |
# endif |
64 |
# elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) |
65 |
# if _BYTE_ORDER == _BIG_ENDIAN |
66 |
# define DSFMT_BIG_ENDIAN 1 |
67 |
# endif |
68 |
# elif defined(__BYTE_ORDER__) && defined(__BIG_ENDIAN__) |
69 |
# if __BYTE_ORDER__ == __BIG_ENDIAN__ |
70 |
# define DSFMT_BIG_ENDIAN 1 |
71 |
# endif |
72 |
# elif defined(BYTE_ORDER) && defined(BIG_ENDIAN) |
73 |
# if BYTE_ORDER == BIG_ENDIAN |
74 |
# define DSFMT_BIG_ENDIAN 1 |
75 |
# endif |
76 |
# elif defined(__BIG_ENDIAN) || defined(_BIG_ENDIAN) \ |
77 |
|| defined(__BIG_ENDIAN__) || defined(BIG_ENDIAN) |
78 |
# define DSFMT_BIG_ENDIAN 1 |
79 |
# endif |
80 |
#endif |
81 |
|
82 |
#if defined(DSFMT_BIG_ENDIAN) && defined(__amd64) |
83 |
# undef DSFMT_BIG_ENDIAN |
84 |
#endif |
85 |
|
86 |
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) |
87 |
# include <inttypes.h> |
88 |
#elif defined(_MSC_VER) || defined(__BORLANDC__) |
89 |
# if !defined(DSFMT_UINT32_DEFINED) && !defined(SFMT_UINT32_DEFINED) |
90 |
typedef unsigned int uint32_t; |
91 |
typedef unsigned __int64 uint64_t; |
92 |
# define UINT64_C(v) (v ## ui64) |
93 |
# define DSFMT_UINT32_DEFINED |
94 |
# if !defined(inline) |
95 |
# define inline __inline |
96 |
# endif |
97 |
# endif |
98 |
#else |
99 |
# include <inttypes.h> |
100 |
# if !defined(inline) |
101 |
# if defined(__GNUC__) |
102 |
# define inline __inline__ |
103 |
# else |
104 |
# define inline |
105 |
# endif |
106 |
# endif |
107 |
#endif |
108 |
|
109 |
#ifndef PRIu64 |
110 |
# if defined(_MSC_VER) || defined(__BORLANDC__) |
111 |
# define PRIu64 "I64u" |
112 |
# define PRIx64 "I64x" |
113 |
# else |
114 |
# define PRIu64 "llu" |
115 |
# define PRIx64 "llx" |
116 |
# endif |
117 |
#endif |
118 |
|
119 |
#ifndef UINT64_C |
120 |
# define UINT64_C(v) (v ## ULL) |
121 |
#endif |
122 |
|
123 |
/*------------------------------------------ |
124 |
128-bit SIMD like data type for standard C |
125 |
------------------------------------------*/ |
126 |
#if defined(HAVE_ALTIVEC) |
127 |
# if !defined(__APPLE__) |
128 |
# include <altivec.h> |
129 |
# endif |
130 |
/** 128-bit data structure */ |
131 |
union W128_T { |
132 |
vector unsigned int s; |
133 |
uint64_t u[2]; |
134 |
uint32_t u32[4]; |
135 |
double d[2]; |
136 |
}; |
137 |
|
138 |
#elif defined(HAVE_SSE2) |
139 |
# include <emmintrin.h> |
140 |
|
141 |
/** 128-bit data structure */ |
142 |
union W128_T { |
143 |
__m128i si; |
144 |
__m128d sd; |
145 |
uint64_t u[2]; |
146 |
uint32_t u32[4]; |
147 |
double d[2]; |
148 |
}; |
149 |
#else /* standard C */ |
150 |
/** 128-bit data structure */ |
151 |
union W128_T { |
152 |
uint64_t u[2]; |
153 |
uint32_t u32[4]; |
154 |
double d[2]; |
155 |
}; |
156 |
#endif |
157 |
|
158 |
/** 128-bit data type */ |
159 |
typedef union W128_T w128_t; |
160 |
|
161 |
/** the 128-bit internal state array */ |
162 |
struct DSFMT_T { |
163 |
w128_t status[DSFMT_N + 1]; |
164 |
int idx; |
165 |
}; |
166 |
typedef struct DSFMT_T dsfmt_t; |
167 |
|
168 |
/** dsfmt internal state vector */ |
169 |
extern dsfmt_t dsfmt_global_data; |
170 |
/** dsfmt mexp for check */ |
171 |
extern const int dsfmt_global_mexp; |
172 |
|
173 |
void dsfmt_gen_rand_all(dsfmt_t *dsfmt); |
174 |
void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], int size); |
175 |
void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], int size); |
176 |
void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], int size); |
177 |
void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], int size); |
178 |
void dsfmt_chk_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed, int mexp); |
179 |
void dsfmt_chk_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[], |
180 |
int key_length, int mexp); |
181 |
const char *dsfmt_get_idstring(void); |
182 |
int dsfmt_get_min_array_size(void); |
183 |
|
184 |
#if defined(__GNUC__) |
185 |
# define DSFMT_PRE_INLINE inline static |
186 |
# define DSFMT_PST_INLINE __attribute__((always_inline)) |
187 |
#elif defined(_MSC_VER) && _MSC_VER >= 1200 |
188 |
# define DSFMT_PRE_INLINE __forceinline static |
189 |
# define DSFMT_PST_INLINE |
190 |
#else |
191 |
# define DSFMT_PRE_INLINE inline static |
192 |
# define DSFMT_PST_INLINE |
193 |
#endif |
194 |
DSFMT_PRE_INLINE uint32_t dsfmt_genrand_uint32(dsfmt_t *dsfmt) DSFMT_PST_INLINE; |
195 |
DSFMT_PRE_INLINE double dsfmt_genrand_close1_open2(dsfmt_t *dsfmt) |
196 |
DSFMT_PST_INLINE; |
197 |
DSFMT_PRE_INLINE double dsfmt_genrand_close_open(dsfmt_t *dsfmt) |
198 |
DSFMT_PST_INLINE; |
199 |
DSFMT_PRE_INLINE double dsfmt_genrand_open_close(dsfmt_t *dsfmt) |
200 |
DSFMT_PST_INLINE; |
201 |
DSFMT_PRE_INLINE double dsfmt_genrand_open_open(dsfmt_t *dsfmt) |
202 |
DSFMT_PST_INLINE; |
203 |
DSFMT_PRE_INLINE uint32_t dsfmt_gv_genrand_uint32(void) DSFMT_PST_INLINE; |
204 |
DSFMT_PRE_INLINE double dsfmt_gv_genrand_close1_open2(void) DSFMT_PST_INLINE; |
205 |
DSFMT_PRE_INLINE double dsfmt_gv_genrand_close_open(void) DSFMT_PST_INLINE; |
206 |
DSFMT_PRE_INLINE double dsfmt_gv_genrand_open_close(void) DSFMT_PST_INLINE; |
207 |
DSFMT_PRE_INLINE double dsfmt_gv_genrand_open_open(void) DSFMT_PST_INLINE; |
208 |
DSFMT_PRE_INLINE void dsfmt_gv_fill_array_open_close(double array[], int size) |
209 |
DSFMT_PST_INLINE; |
210 |
DSFMT_PRE_INLINE void dsfmt_gv_fill_array_close_open(double array[], int size) |
211 |
DSFMT_PST_INLINE; |
212 |
DSFMT_PRE_INLINE void dsfmt_gv_fill_array_open_open(double array[], int size) |
213 |
DSFMT_PST_INLINE; |
214 |
DSFMT_PRE_INLINE void dsfmt_gv_fill_array_close1_open2(double array[], int size) |
215 |
DSFMT_PST_INLINE; |
216 |
DSFMT_PRE_INLINE void dsfmt_gv_init_gen_rand(uint32_t seed) DSFMT_PST_INLINE; |
217 |
DSFMT_PRE_INLINE void dsfmt_gv_init_by_array(uint32_t init_key[], |
218 |
int key_length) DSFMT_PST_INLINE; |
219 |
DSFMT_PRE_INLINE void dsfmt_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed) |
220 |
DSFMT_PST_INLINE; |
221 |
DSFMT_PRE_INLINE void dsfmt_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[], |
222 |
int key_length) DSFMT_PST_INLINE; |
223 |
|
224 |
/** |
225 |
* This function generates and returns unsigned 32-bit integer. |
226 |
* This is slower than SFMT, only for convenience usage. |
227 |
* dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called |
228 |
* before this function. |
229 |
* @param dsfmt dsfmt internal state date |
230 |
* @return double precision floating point pseudorandom number |
231 |
*/ |
232 |
inline static uint32_t dsfmt_genrand_uint32(dsfmt_t *dsfmt) { |
233 |
uint32_t r; |
234 |
uint64_t *psfmt64 = &dsfmt->status[0].u[0]; |
235 |
|
236 |
if (dsfmt->idx >= DSFMT_N64) { |
237 |
dsfmt_gen_rand_all(dsfmt); |
238 |
dsfmt->idx = 0; |
239 |
} |
240 |
r = psfmt64[dsfmt->idx++] & 0xffffffffU; |
241 |
return r; |
242 |
} |
243 |
|
244 |
/** |
245 |
* This function generates and returns double precision pseudorandom |
246 |
* number which distributes uniformly in the range [1, 2). This is |
247 |
* the primitive and faster than generating numbers in other ranges. |
248 |
* dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called |
249 |
* before this function. |
250 |
* @param dsfmt dsfmt internal state date |
251 |
* @return double precision floating point pseudorandom number |
252 |
*/ |
253 |
inline static double dsfmt_genrand_close1_open2(dsfmt_t *dsfmt) { |
254 |
double r; |
255 |
double *psfmt64 = &dsfmt->status[0].d[0]; |
256 |
|
257 |
if (dsfmt->idx >= DSFMT_N64) { |
258 |
dsfmt_gen_rand_all(dsfmt); |
259 |
dsfmt->idx = 0; |
260 |
} |
261 |
r = psfmt64[dsfmt->idx++]; |
262 |
return r; |
263 |
} |
264 |
|
265 |
/** |
266 |
* This function generates and returns unsigned 32-bit integer. |
267 |
* This is slower than SFMT, only for convenience usage. |
268 |
* dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called |
269 |
* before this function. This function uses \b global variables. |
270 |
* @return double precision floating point pseudorandom number |
271 |
*/ |
272 |
inline static uint32_t dsfmt_gv_genrand_uint32(void) { |
273 |
return dsfmt_genrand_uint32(&dsfmt_global_data); |
274 |
} |
275 |
|
276 |
/** |
277 |
* This function generates and returns double precision pseudorandom |
278 |
* number which distributes uniformly in the range [1, 2). |
279 |
* dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called |
280 |
* before this function. This function uses \b global variables. |
281 |
* @return double precision floating point pseudorandom number |
282 |
*/ |
283 |
inline static double dsfmt_gv_genrand_close1_open2(void) { |
284 |
return dsfmt_genrand_close1_open2(&dsfmt_global_data); |
285 |
} |
286 |
|
287 |
/** |
288 |
* This function generates and returns double precision pseudorandom |
289 |
* number which distributes uniformly in the range [0, 1). |
290 |
* dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called |
291 |
* before this function. |
292 |
* @param dsfmt dsfmt internal state date |
293 |
* @return double precision floating point pseudorandom number |
294 |
*/ |
295 |
inline static double dsfmt_genrand_close_open(dsfmt_t *dsfmt) { |
296 |
return dsfmt_genrand_close1_open2(dsfmt) - 1.0; |
297 |
} |
298 |
|
299 |
/** |
300 |
* This function generates and returns double precision pseudorandom |
301 |
* number which distributes uniformly in the range [0, 1). |
302 |
* dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called |
303 |
* before this function. This function uses \b global variables. |
304 |
* @return double precision floating point pseudorandom number |
305 |
*/ |
306 |
inline static double dsfmt_gv_genrand_close_open(void) { |
307 |
return dsfmt_gv_genrand_close1_open2() - 1.0; |
308 |
} |
309 |
|
310 |
/** |
311 |
* This function generates and returns double precision pseudorandom |
312 |
* number which distributes uniformly in the range (0, 1]. |
313 |
* dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called |
314 |
* before this function. |
315 |
* @param dsfmt dsfmt internal state date |
316 |
* @return double precision floating point pseudorandom number |
317 |
*/ |
318 |
inline static double dsfmt_genrand_open_close(dsfmt_t *dsfmt) { |
319 |
return 2.0 - dsfmt_genrand_close1_open2(dsfmt); |
320 |
} |
321 |
|
322 |
/** |
323 |
* This function generates and returns double precision pseudorandom |
324 |
* number which distributes uniformly in the range (0, 1]. |
325 |
* dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called |
326 |
* before this function. This function uses \b global variables. |
327 |
* @return double precision floating point pseudorandom number |
328 |
*/ |
329 |
inline static double dsfmt_gv_genrand_open_close(void) { |
330 |
return 2.0 - dsfmt_gv_genrand_close1_open2(); |
331 |
} |
332 |
|
333 |
/** |
334 |
* This function generates and returns double precision pseudorandom |
335 |
* number which distributes uniformly in the range (0, 1). |
336 |
* dsfmt_init_gen_rand() or dsfmt_init_by_array() must be called |
337 |
* before this function. |
338 |
* @param dsfmt dsfmt internal state date |
339 |
* @return double precision floating point pseudorandom number |
340 |
*/ |
341 |
inline static double dsfmt_genrand_open_open(dsfmt_t *dsfmt) { |
342 |
double *dsfmt64 = &dsfmt->status[0].d[0]; |
343 |
union { |
344 |
double d; |
345 |
uint64_t u; |
346 |
} r; |
347 |
|
348 |
if (dsfmt->idx >= DSFMT_N64) { |
349 |
dsfmt_gen_rand_all(dsfmt); |
350 |
dsfmt->idx = 0; |
351 |
} |
352 |
r.d = dsfmt64[dsfmt->idx++]; |
353 |
r.u |= 1; |
354 |
return r.d - 1.0; |
355 |
} |
356 |
|
357 |
/** |
358 |
* This function generates and returns double precision pseudorandom |
359 |
* number which distributes uniformly in the range (0, 1). |
360 |
* dsfmt_gv_init_gen_rand() or dsfmt_gv_init_by_array() must be called |
361 |
* before this function. This function uses \b global variables. |
362 |
* @return double precision floating point pseudorandom number |
363 |
*/ |
364 |
inline static double dsfmt_gv_genrand_open_open(void) { |
365 |
return dsfmt_genrand_open_open(&dsfmt_global_data); |
366 |
} |
367 |
|
368 |
/** |
369 |
* This function generates double precision floating point |
370 |
* pseudorandom numbers which distribute in the range [1, 2) to the |
371 |
* specified array[] by one call. This function is the same as |
372 |
* dsfmt_fill_array_close1_open2() except that this function uses |
373 |
* \b global variables. |
374 |
* @param array an array where pseudorandom numbers are filled |
375 |
* by this function. |
376 |
* @param size the number of pseudorandom numbers to be generated. |
377 |
* see also \sa dsfmt_fill_array_close1_open2() |
378 |
*/ |
379 |
inline static void dsfmt_gv_fill_array_close1_open2(double array[], int size) { |
380 |
dsfmt_fill_array_close1_open2(&dsfmt_global_data, array, size); |
381 |
} |
382 |
|
383 |
/** |
384 |
* This function generates double precision floating point |
385 |
* pseudorandom numbers which distribute in the range (0, 1] to the |
386 |
* specified array[] by one call. This function is the same as |
387 |
* dsfmt_gv_fill_array_close1_open2() except the distribution range. |
388 |
* This function uses \b global variables. |
389 |
* @param array an array where pseudorandom numbers are filled |
390 |
* by this function. |
391 |
* @param size the number of pseudorandom numbers to be generated. |
392 |
* see also \sa dsfmt_fill_array_close1_open2() and \sa |
393 |
* dsfmt_gv_fill_array_close1_open2() |
394 |
*/ |
395 |
inline static void dsfmt_gv_fill_array_open_close(double array[], int size) { |
396 |
dsfmt_fill_array_open_close(&dsfmt_global_data, array, size); |
397 |
} |
398 |
|
399 |
/** |
400 |
* This function generates double precision floating point |
401 |
* pseudorandom numbers which distribute in the range [0, 1) to the |
402 |
* specified array[] by one call. This function is the same as |
403 |
* dsfmt_gv_fill_array_close1_open2() except the distribution range. |
404 |
* This function uses \b global variables. |
405 |
* @param array an array where pseudorandom numbers are filled |
406 |
* by this function. |
407 |
* @param size the number of pseudorandom numbers to be generated. |
408 |
* see also \sa dsfmt_fill_array_close1_open2() \sa |
409 |
* dsfmt_gv_fill_array_close1_open2() |
410 |
*/ |
411 |
inline static void dsfmt_gv_fill_array_close_open(double array[], int size) { |
412 |
dsfmt_fill_array_close_open(&dsfmt_global_data, array, size); |
413 |
} |
414 |
|
415 |
/** |
416 |
* This function generates double precision floating point |
417 |
* pseudorandom numbers which distribute in the range (0, 1) to the |
418 |
* specified array[] by one call. This function is the same as |
419 |
* dsfmt_gv_fill_array_close1_open2() except the distribution range. |
420 |
* This function uses \b global variables. |
421 |
* @param array an array where pseudorandom numbers are filled |
422 |
* by this function. |
423 |
* @param size the number of pseudorandom numbers to be generated. |
424 |
* see also \sa dsfmt_fill_array_close1_open2() \sa |
425 |
* dsfmt_gv_fill_array_close1_open2() |
426 |
*/ |
427 |
inline static void dsfmt_gv_fill_array_open_open(double array[], int size) { |
428 |
dsfmt_fill_array_open_open(&dsfmt_global_data, array, size); |
429 |
} |
430 |
|
431 |
/** |
432 |
* This function initializes the internal state array with a 32-bit |
433 |
* integer seed. |
434 |
* @param dsfmt dsfmt state vector. |
435 |
* @param seed a 32-bit integer used as the seed. |
436 |
*/ |
437 |
inline static void dsfmt_init_gen_rand(dsfmt_t *dsfmt, uint32_t seed) { |
438 |
dsfmt_chk_init_gen_rand(dsfmt, seed, DSFMT_MEXP); |
439 |
} |
440 |
|
441 |
/** |
442 |
* This function initializes the internal state array with a 32-bit |
443 |
* integer seed. This function uses \b global variables. |
444 |
* @param seed a 32-bit integer used as the seed. |
445 |
* see also \sa dsfmt_init_gen_rand() |
446 |
*/ |
447 |
inline static void dsfmt_gv_init_gen_rand(uint32_t seed) { |
448 |
dsfmt_init_gen_rand(&dsfmt_global_data, seed); |
449 |
} |
450 |
|
451 |
/** |
452 |
* This function initializes the internal state array, |
453 |
* with an array of 32-bit integers used as the seeds. |
454 |
* @param dsfmt dsfmt state vector |
455 |
* @param init_key the array of 32-bit integers, used as a seed. |
456 |
* @param key_length the length of init_key. |
457 |
*/ |
458 |
inline static void dsfmt_init_by_array(dsfmt_t *dsfmt, uint32_t init_key[], |
459 |
int key_length) { |
460 |
dsfmt_chk_init_by_array(dsfmt, init_key, key_length, DSFMT_MEXP); |
461 |
} |
462 |
|
463 |
/** |
464 |
* This function initializes the internal state array, |
465 |
* with an array of 32-bit integers used as the seeds. |
466 |
* This function uses \b global variables. |
467 |
* @param init_key the array of 32-bit integers, used as a seed. |
468 |
* @param key_length the length of init_key. |
469 |
* see also \sa dsfmt_init_by_array() |
470 |
*/ |
471 |
inline static void dsfmt_gv_init_by_array(uint32_t init_key[], int key_length) { |
472 |
dsfmt_init_by_array(&dsfmt_global_data, init_key, key_length); |
473 |
} |
474 |
|
475 |
#if !defined(DSFMT_DO_NOT_USE_OLD_NAMES) |
476 |
DSFMT_PRE_INLINE const char *get_idstring(void) DSFMT_PST_INLINE; |
477 |
DSFMT_PRE_INLINE int get_min_array_size(void) DSFMT_PST_INLINE; |
478 |
DSFMT_PRE_INLINE void init_gen_rand(uint32_t seed) DSFMT_PST_INLINE; |
479 |
DSFMT_PRE_INLINE void init_by_array(uint32_t init_key[], int key_length) |
480 |
DSFMT_PST_INLINE; |
481 |
DSFMT_PRE_INLINE double genrand_close1_open2(void) DSFMT_PST_INLINE; |
482 |
DSFMT_PRE_INLINE double genrand_close_open(void) DSFMT_PST_INLINE; |
483 |
DSFMT_PRE_INLINE double genrand_open_close(void) DSFMT_PST_INLINE; |
484 |
DSFMT_PRE_INLINE double genrand_open_open(void) DSFMT_PST_INLINE; |
485 |
DSFMT_PRE_INLINE void fill_array_open_close(double array[], int size) |
486 |
DSFMT_PST_INLINE; |
487 |
DSFMT_PRE_INLINE void fill_array_close_open(double array[], int size) |
488 |
DSFMT_PST_INLINE; |
489 |
DSFMT_PRE_INLINE void fill_array_open_open(double array[], int size) |
490 |
DSFMT_PST_INLINE; |
491 |
DSFMT_PRE_INLINE void fill_array_close1_open2(double array[], int size) |
492 |
DSFMT_PST_INLINE; |
493 |
|
494 |
/** |
495 |
* This function is just the same as dsfmt_get_idstring(). |
496 |
* @return id string. |
497 |
* see also \sa dsfmt_get_idstring() |
498 |
*/ |
499 |
inline static const char *get_idstring(void) { |
500 |
return dsfmt_get_idstring(); |
501 |
} |
502 |
|
503 |
/** |
504 |
* This function is just the same as dsfmt_get_min_array_size(). |
505 |
* @return minimum size of array used for fill_array functions. |
506 |
* see also \sa dsfmt_get_min_array_size() |
507 |
*/ |
508 |
inline static int get_min_array_size(void) { |
509 |
return dsfmt_get_min_array_size(); |
510 |
} |
511 |
|
512 |
/** |
513 |
* This function is just the same as dsfmt_gv_init_gen_rand(). |
514 |
* @param seed a 32-bit integer used as the seed. |
515 |
* see also \sa dsfmt_gv_init_gen_rand(), \sa dsfmt_init_gen_rand(). |
516 |
*/ |
517 |
inline static void init_gen_rand(uint32_t seed) { |
518 |
dsfmt_gv_init_gen_rand(seed); |
519 |
} |
520 |
|
521 |
/** |
522 |
* This function is just the same as dsfmt_gv_init_by_array(). |
523 |
* @param init_key the array of 32-bit integers, used as a seed. |
524 |
* @param key_length the length of init_key. |
525 |
* see also \sa dsfmt_gv_init_by_array(), \sa dsfmt_init_by_array(). |
526 |
*/ |
527 |
inline static void init_by_array(uint32_t init_key[], int key_length) { |
528 |
dsfmt_gv_init_by_array(init_key, key_length); |
529 |
} |
530 |
|
531 |
/** |
532 |
* This function is just the same as dsfmt_gv_genrand_close1_open2(). |
533 |
* @return double precision floating point number. |
534 |
* see also \sa dsfmt_genrand_close1_open2() \sa |
535 |
* dsfmt_gv_genrand_close1_open2() |
536 |
*/ |
537 |
inline static double genrand_close1_open2(void) { |
538 |
return dsfmt_gv_genrand_close1_open2(); |
539 |
} |
540 |
|
541 |
/** |
542 |
* This function is just the same as dsfmt_gv_genrand_close_open(). |
543 |
* @return double precision floating point number. |
544 |
* see also \sa dsfmt_genrand_close_open() \sa |
545 |
* dsfmt_gv_genrand_close_open() |
546 |
*/ |
547 |
inline static double genrand_close_open(void) { |
548 |
return dsfmt_gv_genrand_close_open(); |
549 |
} |
550 |
|
551 |
/** |
552 |
* This function is just the same as dsfmt_gv_genrand_open_close(). |
553 |
* @return double precision floating point number. |
554 |
* see also \sa dsfmt_genrand_open_close() \sa |
555 |
* dsfmt_gv_genrand_open_close() |
556 |
*/ |
557 |
inline static double genrand_open_close(void) { |
558 |
return dsfmt_gv_genrand_open_close(); |
559 |
} |
560 |
|
561 |
/** |
562 |
* This function is just the same as dsfmt_gv_genrand_open_open(). |
563 |
* @return double precision floating point number. |
564 |
* see also \sa dsfmt_genrand_open_open() \sa |
565 |
* dsfmt_gv_genrand_open_open() |
566 |
*/ |
567 |
inline static double genrand_open_open(void) { |
568 |
return dsfmt_gv_genrand_open_open(); |
569 |
} |
570 |
|
571 |
/** |
572 |
* This function is juset the same as dsfmt_gv_fill_array_open_close(). |
573 |
* @param array an array where pseudorandom numbers are filled |
574 |
* by this function. |
575 |
* @param size the number of pseudorandom numbers to be generated. |
576 |
* see also \sa dsfmt_gv_fill_array_open_close(), \sa |
577 |
* dsfmt_fill_array_close1_open2(), \sa |
578 |
* dsfmt_gv_fill_array_close1_open2() |
579 |
*/ |
580 |
inline static void fill_array_open_close(double array[], int size) { |
581 |
dsfmt_gv_fill_array_open_close(array, size); |
582 |
} |
583 |
|
584 |
/** |
585 |
* This function is juset the same as dsfmt_gv_fill_array_close_open(). |
586 |
* @param array an array where pseudorandom numbers are filled |
587 |
* by this function. |
588 |
* @param size the number of pseudorandom numbers to be generated. |
589 |
* see also \sa dsfmt_gv_fill_array_close_open(), \sa |
590 |
* dsfmt_fill_array_close1_open2(), \sa |
591 |
* dsfmt_gv_fill_array_close1_open2() |
592 |
*/ |
593 |
inline static void fill_array_close_open(double array[], int size) { |
594 |
dsfmt_gv_fill_array_close_open(array, size); |
595 |
} |
596 |
|
597 |
/** |
598 |
* This function is juset the same as dsfmt_gv_fill_array_open_open(). |
599 |
* @param array an array where pseudorandom numbers are filled |
600 |
* by this function. |
601 |
* @param size the number of pseudorandom numbers to be generated. |
602 |
* see also \sa dsfmt_gv_fill_array_open_open(), \sa |
603 |
* dsfmt_fill_array_close1_open2(), \sa |
604 |
* dsfmt_gv_fill_array_close1_open2() |
605 |
*/ |
606 |
inline static void fill_array_open_open(double array[], int size) { |
607 |
dsfmt_gv_fill_array_open_open(array, size); |
608 |
} |
609 |
|
610 |
/** |
611 |
* This function is juset the same as dsfmt_gv_fill_array_close1_open2(). |
612 |
* @param array an array where pseudorandom numbers are filled |
613 |
* by this function. |
614 |
* @param size the number of pseudorandom numbers to be generated. |
615 |
* see also \sa dsfmt_fill_array_close1_open2(), \sa |
616 |
* dsfmt_gv_fill_array_close1_open2() |
617 |
*/ |
618 |
inline static void fill_array_close1_open2(double array[], int size) { |
619 |
dsfmt_gv_fill_array_close1_open2(array, size); |
620 |
} |
621 |
#endif /* DSFMT_DO_NOT_USE_OLD_NAMES */ |
622 |
|
623 |
#endif /* DSFMT_H */ |