libavutil/random.c File Reference

#include <stdio.h>
#include "random.h"

Go to the source code of this file.

Defines

#define M   397
 See http://en.wikipedia.org/wiki/Mersenne_twister for an explanation of this algorithm.
#define A   0x9908b0df
#define UPPER_MASK   0x80000000
#define LOWER_MASK   0x7fffffff

Functions

void av_random_init (AVRandomState *state, unsigned int seed)
 Initializes mt[AV_RANDOM_N] with a seed.
void av_init_random (unsigned int seed, AVRandomState *state)
void av_random_generate_untempered_numbers (AVRandomState *state)
 Generates AV_RANDOM_N words at one time (which will then be tempered later).


Define Documentation

#define A   0x9908b0df

Definition at line 35 of file random.c.

#define LOWER_MASK   0x7fffffff

Definition at line 37 of file random.c.

Referenced by av_random_generate_untempered_numbers().

#define M   397

See http://en.wikipedia.org/wiki/Mersenne_twister for an explanation of this algorithm.

Definition at line 34 of file random.c.

#define UPPER_MASK   0x80000000

Definition at line 36 of file random.c.

Referenced by av_random_generate_untempered_numbers().


Function Documentation

void av_init_random ( unsigned int  seed,
AVRandomState state 
)

Definition at line 60 of file random.c.

void av_random_generate_untempered_numbers ( AVRandomState state  ) 

Generates AV_RANDOM_N words at one time (which will then be tempered later).

Regenerate the untempered numbers (must be done every 624 iterations, or it will loop).

av_random calls this; you shouldn't.

Definition at line 68 of file random.c.

Referenced by av_random().

void av_random_init ( AVRandomState state,
unsigned int  seed 
)

Initializes mt[AV_RANDOM_N] with a seed.

To be inlined, the struct must be visible. So it does not make sense to try and keep it opaque with malloc/free-like calls.

Definition at line 40 of file random.c.

Referenced by av_init_random(), cook_decode_init(), decode_init(), main(), mpc7_decode_init(), mpc8_decode_init(), and roq_encode_init().


Generated on Fri Oct 26 02:35:46 2012 for FFmpeg by  doxygen 1.5.8