A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://ffmpeg.org/pipermail/ffmpeg-devel/2007-January/027082.html below:

[Ffmpeg-devel] [RFC] av_random...

[Ffmpeg-devel] [RFC] av_random...Ryan Martell rdm4
Sat Jan 6 02:56:41 CET 2007
Hi--

I need to have a random for generating a GUID for mms streaming, and  
there also needs to be one for AC3 (right?).  Michael suggested
"a LFG or mersenne twister based av_random() for libavutil would  
certainly be welcome"

I have tweaked some example source code, and have sent an email  
asking the author if he would allow it for inclusion; if not, I'll  
rewrite it based on the published formula.

Does this an interface work for you:

#define AV_RANDOM_PERIOD 624

typedef struct {
     unsigned int magic_cookie; ///< prevent someone from calling  
random without the state setup (sets it up automatically)
     unsigned long mt[AV_RANDOM_PERIOD];	///< the array for the state  
vector
     int mti;
} AVRandomState;

void av_init_random(unsigned long seed, AVRandomState *state);

unsigned long av_random(AVRandomState *state); // 32 bit random
double av_random_real1(AVRandomState *state); // [0-1] as double

Or would you rather have:

AVRandomState *av_init_random(unsigned long seed);
void av_free_random(AVRandomState *state);

unsigned long av_random(AVRandomState *state);

Or something else?

I am passing in the state for thread safety; if that's not a concern,  
we could make it static.

Thanks!
-Ryan





More information about the ffmpeg-devel mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4