Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2009-04-10 21:12:36 +0400
committerDiego Biurrun <diego@biurrun.de>2009-04-10 21:12:36 +0400
commitcc7b62afd2d9b9f3f37f93536a8e69c627f81409 (patch)
treee53c3be76887570d8d580d84a3588771b0e0df2d /libavformat/timefilter.c
parenta2085cccfa4aaf21596443b7a78adde1da359a39 (diff)
Replace rand() usage by av_lfg_get().
Originally committed as revision 18420 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/timefilter.c')
-rw-r--r--libavformat/timefilter.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavformat/timefilter.c b/libavformat/timefilter.c
index 34672b71a1..4a582242ec 100644
--- a/libavformat/timefilter.c
+++ b/libavformat/timefilter.c
@@ -76,9 +76,12 @@ double ff_timefilter_update(TimeFilter *self, double system_time, double period)
}
#ifdef TEST
-#undef rand
+#include "libavutil/lfg.h"
+#define LFG_MAX ((1LL << 32) - 1)
+
int main(void)
{
+ AVLFG prng;
double n0,n1;
#define SAMPLES 1000
double ideal[SAMPLES];
@@ -96,10 +99,11 @@ int main(void)
double bestpar1=0.001;
int better, i;
- srandom(123);
+ av_lfg_init(&prng, 123);
for(i=0; i<SAMPLES; i++){
ideal[i] = 10 + i + n1*i/(1000);
- samples[i]= ideal[i] + n0*(rand()-RAND_MAX/2)/(RAND_MAX*10LL);
+ samples[i] = ideal[i] + n0 * (av_lfg_get(&prng) - LFG_MAX / 2)
+ / (LFG_MAX * 10LL);
}
do{