meta: rename to fx
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
|
||||
#include "random.h"
|
||||
|
||||
#include <blue/core/random.h>
|
||||
#include <fx/core/random.h>
|
||||
|
||||
#define NN 312
|
||||
#define MM 156
|
||||
@@ -64,7 +64,7 @@
|
||||
#define LM 0x7FFFFFFFULL /* Least significant 31 bits */
|
||||
|
||||
/* initializes mt[NN] with a seed */
|
||||
static void init_genrand64(struct b_random_ctx *context, unsigned long long seed)
|
||||
static void init_genrand64(struct fx_random_ctx *context, unsigned long long seed)
|
||||
{
|
||||
context->__mt19937.mt[0] = seed;
|
||||
for (context->__mt19937.mti = 1; context->__mt19937.mti < NN;
|
||||
@@ -82,7 +82,7 @@ static void init_genrand64(struct b_random_ctx *context, unsigned long long seed
|
||||
/* init_key is the array for initializing keys */
|
||||
/* key_length is its length */
|
||||
static void init_by_array64(
|
||||
struct b_random_ctx *context, unsigned long long init_key[],
|
||||
struct fx_random_ctx *context, unsigned long long init_key[],
|
||||
unsigned long long key_length)
|
||||
{
|
||||
unsigned long long i, j, k;
|
||||
@@ -125,7 +125,7 @@ static void init_by_array64(
|
||||
}
|
||||
|
||||
/* generates a random number on [0, 2^64-1]-interval */
|
||||
static uint64_t genrand64_int64(struct b_random_ctx *context)
|
||||
static uint64_t genrand64_int64(struct fx_random_ctx *context)
|
||||
{
|
||||
#if 0
|
||||
/* This is the original implementation. It is replaced by the alternate implementation, below. */
|
||||
@@ -218,25 +218,25 @@ static uint64_t genrand64_int64(struct b_random_ctx *context)
|
||||
}
|
||||
|
||||
/* generates a random number on [0,1]-real-interval */
|
||||
double genrand64_real1(struct b_random_ctx *context)
|
||||
double genrand64_real1(struct fx_random_ctx *context)
|
||||
{
|
||||
return (genrand64_int64(context) >> 11) * (1.0 / 9007199254740991.0);
|
||||
}
|
||||
|
||||
/* generates a random number on [0,1)-real-interval */
|
||||
double genrand64_real2(struct b_random_ctx *context)
|
||||
double genrand64_real2(struct fx_random_ctx *context)
|
||||
{
|
||||
return (genrand64_int64(context) >> 11) * (1.0 / 9007199254740992.0);
|
||||
}
|
||||
|
||||
/* generates a random number on (0,1)-real-interval */
|
||||
double genrand64_real3(struct b_random_ctx *context)
|
||||
double genrand64_real3(struct fx_random_ctx *context)
|
||||
{
|
||||
return ((genrand64_int64(context) >> 12) + 0.5)
|
||||
* (1.0 / 4503599627370496.0);
|
||||
}
|
||||
|
||||
struct b_random_algorithm z__b_gen_mt19937 = {
|
||||
struct fx_random_algorithm z__fx_gen_mt19937 = {
|
||||
.gen_name = "mt19937",
|
||||
.gen_init = init_genrand64,
|
||||
.gen_getrand = genrand64_int64,
|
||||
|
||||
Reference in New Issue
Block a user