[FFmpeg-devel] [PATCH] get rid of rand() usage in libavformat/timefilter.c

Diego Biurrun diego
Fri Apr 10 17:49:45 CEST 2009


On Fri, Apr 10, 2009 at 05:41:47PM +0200, Reimar D?ffinger wrote:
> On Fri, Apr 10, 2009 at 05:10:57PM +0200, Diego Biurrun wrote:
> > +#define LFG_MAX ((1ULL << 32) - 1)
> 
> Oh well, changing 1ULL to 1LL here is the simplest solution.

OK, that helps.

> > +
> >  int main(void)
> >  {
> > +    AVLFG prn;
> 
> prn seems a bit badly chosen. prng would be the usual abbreviation.

Why?  It is a Pseudo Random Number, not a Pseudo Random Number
Generator..

The output of the program still changes, is this a problem?

before

 [0.800000 0.000800  0.000000] [1.021025 0.998922  0.000000] [1.021025 0.998922  0.000000] [1.021025 0.998922  0.000000]
 [0.001264 0.000002  0.019994] [0.048488 0.001118  0.039767] [0.081175 0.002607  0.059857] [0.112743 0.007936  0.096211]
 [0.001505 0.000001  0.050045] [0.024826 0.000382  0.264977] [0.043980 0.001475  0.391406] [0.064399 0.001892  0.452524]
 [0.001040 0.000002  0.464381] [0.012711 0.000210  0.879196] [0.023644 0.000493  1.418645] [0.049066 0.000790  2.186131]
 [0.001517 0.000000  0.941461] [0.003967 0.000078  2.501324] [0.010169 0.000189  4.348705] [0.024826 0.000734  4.730559]
 [0.001813 0.000013  3.654420] [0.003022 0.000062  3.557348] [0.005727 0.000125 18.313767] [0.014412 0.000256 14.544892]

after

 [0.800000 0.000800  0.000000] [1.021025 0.998922  0.000000] [1.021025 0.998922  0.000000] [1.021025 0.998922  0.000000]
 [0.001003 0.000000  0.004341] [0.041562 0.000996  0.045245] [0.081175 0.002874  0.074431] [0.118380 0.006568  0.108913]
 [0.001003 0.000000  0.039073] [0.013619 0.000455  0.224390] [0.041562 0.000996  0.407205] [0.068719 0.002305  0.600848]
 [0.001003 0.000000  0.212729] [0.022518 0.000060  0.941262] [0.015889 0.000507  1.391585] [0.041562 0.000996  2.217003]
 [0.001003 0.000000  0.976818] [0.014412 0.000021  2.712350] [0.013691 0.000370  4.648765] [0.018915 0.000542  6.709646]
 [0.001003 0.000000  4.172097] [0.010677 0.000007  7.809261] [0.018915 0.000032 14.578784] [0.013619 0.000387 20.628496]

Diego



More information about the ffmpeg-devel mailing list