File: mt64.h

package info (click to toggle)
pluto-find-orb 0.0~git20180227-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,668 kB
  • sloc: cpp: 30,743; makefile: 263
file content (31 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef RESTRICT
   #if defined (__cplusplus) && !defined( _MSC_VER) && !defined( __WATCOMC__)
      #define RESTRICT __restrict
   #else
      #define RESTRICT
   #endif
#endif

#ifdef __cplusplus
extern "C" {
#endif /* #ifdef __cplusplus */

void init_mt64( const uint64_t seed, uint64_t *mt);
void init_mt64_by_array( const uint64_t init_key[],
          const uint64_t key_length, uint64_t *mt);
uint64_t mt64( uint64_t * RESTRICT mt);
uint64_t mt64_get_bits( uint64_t *mt, const int n_bits);
double mt64_double( uint64_t * RESTRICT mt);

#ifdef __cplusplus
}
#endif  /* #ifdef __cplusplus */

  /* An MT-64 state contains 312 64-bit values for the actual PRNG; */
  /*  plus an index value telling us where we are within the        */
  /* "cycle",  ranging from 1 to 312;  plus a value telling us how  */
  /* many leftover bits are stored for use in the mt64_get_bits()   */
  /* function;  plus the (up to) 64 bits actually stored.  That     */
  /* means we need an array of 312 + 1 + 1 + 1 = 315 int64_ts.      */

#define MT_STATE_SIZE    315