#include <stdio.h>
#include <inttypes.h>
Go to the source code of this file.
Defines | |
#define | PRIu64 "llu" |
#define | PRIx64 "llx" |
#define | ALWAYSINLINE |
#define | PRE_ALWAYS inline |
Functions | |
uint32_t | gen_rand32 (void) |
uint64_t | gen_rand64 (void) |
void | fill_array32 (uint32_t *array, int size) |
void | fill_array64 (uint64_t *array, int size) |
void | init_gen_rand (uint32_t seed) |
void | init_by_array (uint32_t *init_key, int key_length) |
const char * | get_idstring (void) |
int | get_min_array_size32 (void) |
int | get_min_array_size64 (void) |
static double | to_real1 (uint32_t v) |
static double | genrand_real1 (void) |
static double | to_real2 (uint32_t v) |
static double | genrand_real2 (void) |
static double | to_real3 (uint32_t v) |
static double | genrand_real3 (void) |
static double | to_res53 (uint64_t v) |
static double | to_res53_mix (uint32_t x, uint32_t y) |
static double | genrand_res53 (void) |
static double | genrand_res53_mix (void) |
Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima University. All rights reserved.
The new BSD License is applied to this software. see LICENSE.txt
typedef unsigned int uint32_t typedef unsigned long long uint64_t #define PRIu64 "llu" #define PRIx64 "llx"
Definition in file SFMT.h.
void fill_array32 | ( | uint32_t * | array, | |
int | size | |||
) |
This function generates pseudorandom 32-bit integers in the specified array[] by one call. The number of pseudorandom integers is specified by the argument size, which must be at least 624 and a multiple of four. The generation by this function is much faster than the following gen_rand function.
For initialization, init_gen_rand or init_by_array must be called before the first call of this function. This function can not be used after calling gen_rand function, without initialization.
array | an array where pseudorandom 32-bit integers are filled by this function. The pointer to the array must be "aligned" (namely, must be a multiple of 16) in the SIMD version, since it refers to the address of a 128-bit integer. In the standard C version, the pointer is arbitrary. | |
size | the number of 32-bit pseudorandom integers to be generated. size must be a multiple of 4, and greater than or equal to (MEXP / 128 + 1) * 4. |
Definition at line 481 of file SFMT.cpp.
References gen_rand_array(), idx, initialized, and N32.
void fill_array64 | ( | uint64_t * | array, | |
int | size | |||
) |
This function generates pseudorandom 64-bit integers in the specified array[] by one call. The number of pseudorandom integers is specified by the argument size, which must be at least 312 and a multiple of two. The generation by this function is much faster than the following gen_rand function.
For initialization, init_gen_rand or init_by_array must be called before the first call of this function. This function can not be used after calling gen_rand function, without initialization.
array | an array where pseudorandom 64-bit integers are filled by this function. The pointer to the array must be "aligned" (namely, must be a multiple of 16) in the SIMD version, since it refers to the address of a 128-bit integer. In the standard C version, the pointer is arbitrary. | |
size | the number of 64-bit pseudorandom integers to be generated. size must be a multiple of 2, and greater than or equal to (MEXP / 128 + 1) * 2 |
Definition at line 517 of file SFMT.cpp.
References gen_rand_array(), idx, initialized, N32, N64, and cimg_library::cimg::swap().
uint32_t gen_rand32 | ( | void | ) |
This function generates and returns 32-bit pseudorandom number. init_gen_rand or init_by_array must be called before this function.
Definition at line 410 of file SFMT.cpp.
References gen_rand_all(), idx, initialized, N32, and psfmt32.
Referenced by genrand_real1(), genrand_real2(), genrand_real3(), and genrand_res53_mix().
uint64_t gen_rand64 | ( | void | ) |
This function generates and returns 64-bit pseudorandom number. init_gen_rand or init_by_array must be called before this function. The function gen_rand64 should not be called after gen_rand32, unless an initialization is again executed.
Definition at line 429 of file SFMT.cpp.
References gen_rand_all(), idx, initialized, N32, psfmt32, and psfmt64.
Referenced by genrand_res53().
static double genrand_real1 | ( | void | ) | [inline, static] |
generates a random number on [0,1]-real-interval
Definition at line 94 of file SFMT.h.
References gen_rand32(), and to_real1().
static double genrand_real2 | ( | void | ) | [inline, static] |
generates a random number on [0,1)-real-interval
Definition at line 107 of file SFMT.h.
References gen_rand32(), and to_real2().
static double genrand_real3 | ( | void | ) | [inline, static] |
generates a random number on (0,1)-real-interval
Definition at line 120 of file SFMT.h.
References gen_rand32(), and to_real3().
static double genrand_res53 | ( | void | ) | [inline, static] |
generates a random number on [0,1) with 53-bit resolution
Definition at line 141 of file SFMT.h.
References gen_rand64(), and to_res53().
static double genrand_res53_mix | ( | void | ) | [inline, static] |
generates a random number on [0,1) with 53-bit resolution using 32bit integer.
Definition at line 149 of file SFMT.h.
References gen_rand32(), and to_res53_mix().
const char* get_idstring | ( | void | ) |
int get_min_array_size32 | ( | void | ) |
This function returns the minimum size of array used for fill_array32() function.
Definition at line 391 of file SFMT.cpp.
References N32.
int get_min_array_size64 | ( | void | ) |
This function returns the minimum size of array used for fill_array64() function.
Definition at line 400 of file SFMT.cpp.
References N64.
void init_by_array | ( | uint32_t * | init_key, | |
int | key_length | |||
) |
This function initializes the internal state array, with an array of 32-bit integers used as the seeds
init_key | the array of 32-bit integers, used as a seed. | |
key_length | the length of init_key. |
Definition at line 557 of file SFMT.cpp.
References func1(), func2(), idx, idxof(), initialized, N, N32, period_certification(), and psfmt32.
void init_gen_rand | ( | uint32_t | seed | ) |
This function initializes the internal state array with a 32-bit integer seed.
seed | a 32-bit integer used as the seed. |
Definition at line 537 of file SFMT.cpp.
References idx, idxof(), initialized, N32, period_certification(), and psfmt32.
static double to_real1 | ( | uint32_t | v | ) | [inline, static] |
generates a random number on [0,1]-real-interval
Definition at line 87 of file SFMT.h.
Referenced by genrand_real1().
static double to_real2 | ( | uint32_t | v | ) | [inline, static] |
generates a random number on [0,1)-real-interval
Definition at line 100 of file SFMT.h.
Referenced by genrand_real2().
static double to_real3 | ( | uint32_t | v | ) | [inline, static] |
generates a random number on (0,1)-real-interval
Definition at line 113 of file SFMT.h.
Referenced by genrand_real3().
static double to_res53 | ( | uint64_t | v | ) | [inline, static] |
These real versions are due to Isaku Wada generates a random number on [0,1) with 53-bit resolution
Definition at line 127 of file SFMT.h.
Referenced by genrand_res53(), and to_res53_mix().
static double to_res53_mix | ( | uint32_t | x, | |
uint32_t | y | |||
) | [inline, static] |
generates a random number on [0,1) with 53-bit resolution from two 32 bit integers
Definition at line 134 of file SFMT.h.
References to_res53().
Referenced by genrand_res53_mix().