1 /** 2 * @file SFMT.h 3 * 4 * @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom 5 * number generator 6 * 7 * @author Mutsuo Saito (Hiroshima University) 8 * @author Makoto Matsumoto (Hiroshima University) 9 * 10 * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima 11 * 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 SFMT_H 32 #define SFMT_H 33 34 #include <stdio.h> 35 36 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 37 #include <inttypes.h> 38 #elif defined(_MSC_VER) || defined(__BORLANDC__) 39 typedef unsigned int uint32_t; 40 typedef unsigned __int64 uint64_t; 41 #define inline __inline 42 #else 43 #include <inttypes.h> 44 #if defined(__GNUC__) 45 #define inline __inline__ 46 #endif 47 #endif 48 49 #ifndef PRIu64 50 #if defined(_MSC_VER) || defined(__BORLANDC__) 51 #define PRIu64 "I64u" 52 #define PRIx64 "I64x" 53 #else 54 #define PRIu64 "llu" 55 #define PRIx64 "llx" 56 #endif 57 #endif 58 59 #if defined(__GNUC__) 60 #define ALWAYSINLINE __attribute__((always_inline)) 61 #else 62 #define ALWAYSINLINE 63 #endif 64 65 #if defined(_MSC_VER) 66 #if _MSC_VER >= 1200 67 #define PRE_ALWAYS __forceinline 68 #else 69 #define PRE_ALWAYS inline 70 #endif 71 #else 72 #define PRE_ALWAYS inline 73 #endif 74 75 /* these are not needed in public 76 uint32_t gen_rand32(void); 77 uint64_t gen_rand64(void); 78 void fill_array32(uint32_t *array, int size); 79 void fill_array64(uint64_t *array, int size); 80 void init_gen_rand(uint32_t seed); 81 void init_by_array(uint32_t *init_key, int key_length); 82 const char *get_idstring(void); 83 int get_min_array_size32(void); 84 int get_min_array_size64(void); 85 */ 86 87 #endif 88