Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
randomkit.c File Reference
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <neatogen/randomkit.h>
Include dependency graph for randomkit.c:

Go to the source code of this file.

Macros

#define RK_DEV_URANDOM   "/dev/urandom"
 
#define RK_DEV_RANDOM   "/dev/random"
 
#define N   624
 
#define M   397
 
#define MATRIX_A   0x9908b0dfUL
 
#define UPPER_MASK   0x80000000UL
 
#define LOWER_MASK   0x7fffffffUL
 

Functions

void rk_seed (unsigned long seed, rk_state *state)
 
unsigned long rk_random (rk_state *state)
 
unsigned long rk_ulong (rk_state *state)
 
unsigned long rk_interval (unsigned long max, rk_state *state)
 

Macro Definition Documentation

◆ LOWER_MASK

#define LOWER_MASK   0x7fffffffUL

Definition at line 101 of file randomkit.c.

◆ M

#define M   397

Definition at line 98 of file randomkit.c.

◆ MATRIX_A

#define MATRIX_A   0x9908b0dfUL

Definition at line 99 of file randomkit.c.

◆ N

#define N   624

Definition at line 97 of file randomkit.c.

◆ RK_DEV_RANDOM

#define RK_DEV_RANDOM   "/dev/random"

Definition at line 79 of file randomkit.c.

◆ RK_DEV_URANDOM

#define RK_DEV_URANDOM   "/dev/urandom"

Definition at line 75 of file randomkit.c.

◆ UPPER_MASK

#define UPPER_MASK   0x80000000UL

Definition at line 100 of file randomkit.c.

Function Documentation

◆ rk_interval()

unsigned long rk_interval ( unsigned long  max,
rk_state state 
)

Definition at line 147 of file randomkit.c.

References rk_random(), rk_ulong(), and state.

Referenced by fisheryates_shuffle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rk_random()

unsigned long rk_random ( rk_state state)

Definition at line 105 of file randomkit.c.

References LOWER_MASK, M, MATRIX_A, N, RK_STATE_LEN, state, and UPPER_MASK.

Referenced by rk_interval(), and rk_ulong().

Here is the caller graph for this function:

◆ rk_seed()

void rk_seed ( unsigned long  seed,
rk_state state 
)

Definition at line 83 of file randomkit.c.

References RK_STATE_LEN, seed, and state.

Referenced by sgd().

Here is the caller graph for this function:

◆ rk_ulong()

unsigned long rk_ulong ( rk_state state)

Definition at line 137 of file randomkit.c.

References rk_random(), and state.

Referenced by rk_interval().

Here is the call graph for this function:
Here is the caller graph for this function: