Go to the documentation of this file.
54 unsigned a =
c->state[
c->index & 63] =
c->state[(
c->index-24) & 63] +
c->state[(
c->index-55) & 63];
65 unsigned int a=
c->state[(
c->index-55) & 63];
66 unsigned int b=
c->state[(
c->index-24) & 63];
67 a =
c->state[
c->index & 63] = 2*
a*
b+
a+
b;
void av_lfg_init(AVLFG *c, unsigned int seed)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
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...
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Context structure for the Lagged Fibonacci PRNG.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length)
Seed the state of the ALFG using binary data.
static unsigned int av_mlfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using a MLFG.