DSP_urand32
[DSP_urand32_init]

Collaboration diagram for DSP_urand32:


Detailed Description

typedef unsigned int _ti_uint32
typedef int _ti_int32
void DSP_urand32 (unsigned int size, void *vector, void *state)
static _ti_uint32 DSP_urand32_get_ti_uint32 (_ti_uint32 s0, _ti_uint32 s2, _ti_uint32 s3, const _ti_uint32 tmat)
static void DSP_urand32_next_state (_ti_uint32 *s0, _ti_uint32 *s1, _ti_uint32 *s2, _ti_uint32 *s3, const _ti_uint32 mat1, const _ti_uint32 mat2)
static _ti_uint32 DSP_urand32_generate_random_ti_uint32 (_ti_uint32 *s0, _ti_uint32 *s1, _ti_uint32 *s2, _ti_uint32 *s3, const _ti_uint32 mat1, const _ti_uint32 mat2, const _ti_uint32 tmat)
void DSP_urand32_init (unsigned int seed, void *restrict polynomial, void *restrict state)
#define DSP_urand32_STATUS_0   (0)
#define DSP_urand32_STATUS_1   (1)
#define DSP_urand32_STATUS_2   (2)
#define DSP_urand32_STATUS_3   (3)
#define DSP_urand32_MAT_1   (4)
#define DSP_urand32_MAT_2   (5)
#define DSP_urand32_TMAT   (6)
#define DSP_urand32_TINYMT_MASK   (0x7ffffffful)
#define DSPF_sp_urand_UINT_TO_FLOAT   2.3283063e-010
#define DSP_urand32_SAVE_STATE(s0, s1, s2, s3)


Define Documentation

#define DSP_urand32_STATUS_0   (0)

Definition at line 174 of file c66/DSP_urand32.h.

#define DSP_urand32_STATUS_1   (1)

Definition at line 175 of file c66/DSP_urand32.h.

#define DSP_urand32_STATUS_2   (2)

Definition at line 176 of file c66/DSP_urand32.h.

#define DSP_urand32_STATUS_3   (3)

Definition at line 177 of file c66/DSP_urand32.h.

#define DSP_urand32_MAT_1   (4)

Definition at line 180 of file c66/DSP_urand32.h.

#define DSP_urand32_MAT_2   (5)

Definition at line 181 of file c66/DSP_urand32.h.

#define DSP_urand32_TMAT   (6)

Definition at line 182 of file c66/DSP_urand32.h.

#define DSP_urand32_TINYMT_MASK   (0x7ffffffful)

Definition at line 184 of file c66/DSP_urand32.h.

Referenced by DSP_urand32_next_state().

#define DSPF_sp_urand_UINT_TO_FLOAT   2.3283063e-010

Definition at line 185 of file c66/DSP_urand32.h.

#define DSP_urand32_SAVE_STATE ( s0,
s1,
s2,
s3   ) 

Value:

{v_state[DSP_urand32_STATUS_0] = (s0);                    \
            v_state[DSP_urand32_STATUS_1] = (s1);                    \
            v_state[DSP_urand32_STATUS_2] = (s2);                    \
            v_state[DSP_urand32_STATUS_3] = (s3);}

Definition at line 190 of file c66/DSP_urand32.h.


Typedef Documentation

typedef unsigned int _ti_uint32

Definition at line 167 of file c66/DSP_urand32.h.

typedef int _ti_int32

Definition at line 168 of file c66/DSP_urand32.h.


Function Documentation

void DSP_urand32 ( unsigned int  size,
void *  vector,
void *  state 
)

This function is used to fill an array with uniformly distributed random unsigned 32-bit integers on the interval [0,(2^32)-1].

Parameters:
size = The size of the array to be filled.
vector = The array which the user wants to fill with random values. Again, it should be of type unsigned int.
state = The array which was initialized with the "DSP_urand32_init" function and maintained (but NEVER modified) by the user between subsequent calls to this function.
Algorithm:
The random number generator is based on the Tiny Mersenne Twister (TinyMT). Click here for more information.
Assumptions:
The user has previously called the "DSP_urand32_init" function at least once, has maintained the state array, and allocated an array of int types of the desired width.
Implementation notes:
Endian Support: The code supports both big and little endian modes.
Interruptibility: The code is not interruptible.

static _ti_uint32 DSP_urand32_get_ti_uint32 ( _ti_uint32  s0,
_ti_uint32  s2,
_ti_uint32  s3,
const _ti_uint32  tmat 
) [inline, static]

Definition at line 225 of file c66/DSP_urand32.h.

Referenced by DSP_urand32_generate_random_ti_uint32().

static void DSP_urand32_next_state ( _ti_uint32 s0,
_ti_uint32 s1,
_ti_uint32 s2,
_ti_uint32 s3,
const _ti_uint32  mat1,
const _ti_uint32  mat2 
) [inline, static]

Definition at line 270 of file c66/DSP_urand32.h.

References DSP_urand32_TINYMT_MASK.

Referenced by DSP_urand32_generate_random_ti_uint32().

static _ti_uint32 DSP_urand32_generate_random_ti_uint32 ( _ti_uint32 s0,
_ti_uint32 s1,
_ti_uint32 s2,
_ti_uint32 s3,
const _ti_uint32  mat1,
const _ti_uint32  mat2,
const _ti_uint32  tmat 
) [inline, static]

Definition at line 325 of file c66/DSP_urand32.h.

References DSP_urand32_get_ti_uint32(), and DSP_urand32_next_state().

Here is the call graph for this function:

void DSP_urand32_init ( unsigned int  seed,
void *restrict  polynomial,
void *restrict  state 
)

This function is used to seed the uniformly distributed random number generator (RNG). It must be called prior to using any of the 32-bit RNG's provided in DSPLIB

Parameters:
seed = An arbitrary unsigned integer chosen by the user.
polynomial = Array of 3 non-arbitrary unsigned integers, previously generated using the included TinyMTDC program and/or from the provided text file; numbers from different sets MUST NOT be mixed and matched. Should the user provide a NULL pointer instead, default values will be used instead. These parameters ensure (mostly) statistically independent random numbers among different generators. Users should place numbers in the polynomial parameter in the order in which they appear in the text file or TinyMTDC program. That is columns 0, 1, and 2 (mat1, mat2, and tmat of TinyMTDC) correspond to positions 0, 1, and 2 of the polynomial.
state = An array of 7 unsigned 32-bit integers which need not be initialized to any values by the user; the user is only required to allocate such space and maintain (but NEVER modify) it.
Algorithm:
The random number generator is based on the Tiny Mersenne Twister (TinyMT). Click here for more information.
Assumptions:
The user has properly initialized the "polynomial" and "state" parameters.
Implementation notes:
Endian Support: The code supports both big and little endian modes.
Interruptibility: The code not interruptible.


Copyright 2014, Texas Instruments Incorporated