Embedded Artistry Framework
Embedded Systems C++ Framework
Functions | Variables
rand.c File Reference
#include "test.h"
Include dependency graph for rand.c:

Functions

static uint32_t rand32 (void)
 
static uint64_t rand64 (void)
 
void test_randseed (uint64_t s)
 
uint64_t test_randn (uint64_t n)
 
uint64_t test_randint (uint64_t a, uint64_t b)
 
static void shuffle2 (uint64_t *p, uint64_t *q, size_t np, size_t nq)
 
void test_shuffle (uint64_t *p, size_t n)
 
void test_randrange (uint64_t *p, size_t n)
 
static int insert (uint64_t *tab, size_t len, uint64_t v)
 
int t_choose (uint64_t n, size_t k, uint64_t *p)
 

Variables

static uint64_t seed = UINT64_MAX
 

Function Documentation

◆ insert()

static int insert ( uint64_t tab,
size_t  len,
uint64_t  v 
)
static

Referenced by t_choose().

◆ rand32()

static uint32_t rand32 ( void  )
static

References seed.

Referenced by rand64().

◆ rand64()

static uint64_t rand64 ( void  )
static

References rand32(), and u.

Referenced by test_randint(), and test_randn().

◆ shuffle2()

static void shuffle2 ( uint64_t p,
uint64_t q,
size_t  np,
size_t  nq 
)
static

References p, r, t, and test_randn().

Referenced by t_choose(), and test_shuffle().

◆ t_choose()

int t_choose ( uint64_t  n,
size_t  k,
uint64_t p 
)

◆ test_randint()

uint64_t test_randint ( uint64_t  a,
uint64_t  b 
)

References a, b, n, rand64(), and test_randn().

◆ test_randn()

uint64_t test_randn ( uint64_t  n)

References n, r, rand64(), and UINT64_MAX.

Referenced by shuffle2(), t_choose(), test_randint(), and uint64_gen().

Here is the caller graph for this function:

◆ test_randrange()

void test_randrange ( uint64_t p,
size_t  n 
)

References n, p, and test_shuffle().

◆ test_randseed()

void test_randseed ( uint64_t  s)

References s, and seed.

Referenced by uint64_gen().

Here is the caller graph for this function:

◆ test_shuffle()

void test_shuffle ( uint64_t p,
size_t  n 
)

References n, p, and shuffle2().

Referenced by test_randrange(), and uint64_gen().

Here is the caller graph for this function:

Variable Documentation

◆ seed

uint64_t seed = UINT64_MAX
static

Referenced by rand32(), srand(), and test_randseed().