Revision 2cf3c863 libavutil/lfg.h
libavutil/lfg.h | ||
---|---|---|
29 | 29 |
|
30 | 30 |
void av_lfg_init(AVLFG *c, unsigned int seed); |
31 | 31 |
|
32 |
/** |
|
33 |
* Gets the next random unsigned 32bit number. |
|
34 |
* |
|
35 |
* Please also consider a simple LCG like state= state*1664525+1013904223, |
|
36 |
* it may be good enough and faster for your specific use case. |
|
37 |
*/ |
|
32 | 38 |
static inline unsigned int av_lfg_get(AVLFG *c){ |
33 | 39 |
c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; |
34 | 40 |
return c->state[c->index++ & 63]; |
Also available in: Unified diff