FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
lfg.h File Reference
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  AVLFG
 

Functions

void av_lfg_init (AVLFG *c, unsigned int seed)
 
int av_lfg_init_from_data (AVLFG *c, const uint8_t *data, unsigned int length)
 Seed the state of the ALFG using binary data. More...
 
static unsigned int av_lfg_get (AVLFG *c)
 Get the next random unsigned 32-bit number using an ALFG. More...
 
static unsigned int av_mlfg_get (AVLFG *c)
 Get the next random unsigned 32-bit number using a MLFG. More...
 
void av_bmg_get (AVLFG *lfg, double out[2])
 Get the next two numbers generated by a Box-Muller Gaussian generator using the random numbers issued by lfg. More...
 

Function Documentation

void av_lfg_init ( AVLFG c,
unsigned int  seed 
)
int av_lfg_init_from_data ( AVLFG c,
const uint8_t data,
unsigned int  length 
)

Seed the state of the ALFG using binary data.

Return value: 0 on success, negative value (AVERROR) on failure.

Definition at line 64 of file lfg.c.

Referenced by ac3_decode_frame().

static unsigned int av_lfg_get ( AVLFG c)
inlinestatic
static unsigned int av_mlfg_get ( AVLFG c)
inlinestatic

Get the next random unsigned 32-bit number using a MLFG.

Please also consider av_lfg_get() above, it is faster.

Definition at line 57 of file lfg.h.

void av_bmg_get ( AVLFG lfg,
double  out[2] 
)

Get the next two numbers generated by a Box-Muller Gaussian generator using the random numbers issued by lfg.

Parameters
outarray where the two generated numbers are placed

Definition at line 49 of file lfg.c.

Referenced by fill_double_array(), fill_float_array(), and main().