Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AVUTIL_LFG_H
00023 #define AVUTIL_LFG_H
00024
00025 typedef struct {
00026 unsigned int state[64];
00027 int index;
00028 } AVLFG;
00029
00030 void av_lfg_init(AVLFG *c, unsigned int seed);
00031
00038 static inline unsigned int av_lfg_get(AVLFG *c){
00039 c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
00040 return c->state[c->index++ & 63];
00041 }
00042
00048 static inline unsigned int av_mlfg_get(AVLFG *c){
00049 unsigned int a= c->state[(c->index-55) & 63];
00050 unsigned int b= c->state[(c->index-24) & 63];
00051 return c->state[c->index++ & 63] = 2*a*b+a+b;
00052 }
00053
00060 void av_bmg_get(AVLFG *lfg, double out[2]);
00061
00062 #endif