aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-07-08 15:01:05 +0100
committerMans Rullgard <mans@mansr.com>2011-07-11 21:09:27 +0100
commit7ce914fb5a4ae974985368ce98db4031c034d513 (patch)
tree80ec02887d7c97e8af767fd196ef27c7062d90da /libavutil
parent1fef92fd7390cda7e5a2655c1c7cfc0851c9a66e (diff)
downloadffmpeg-7ce914fb5a4ae974985368ce98db4031c034d513.tar.gz
lls: use av_lfg instead of rand() in test program
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/lls.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavutil/lls.c b/libavutil/lls.c
index eba7375854..b29fc968da 100644
--- a/libavutil/lls.c
+++ b/libavutil/lls.c
@@ -118,24 +118,27 @@ double av_evaluate_lls(LLSModel *m, double *param, int order)
#ifdef TEST
-#include <stdlib.h>
#include <stdio.h>
+#include <limits.h>
+#include "lfg.h"
int main(void)
{
LLSModel m;
int i, order;
+ AVLFG lfg;
+ av_lfg_init(&lfg, 1);
av_init_lls(&m, 3);
for (i = 0; i < 100; i++) {
double var[4];
double eval;
- var[0] = (rand() / (double) RAND_MAX - 0.5) * 2;
- var[1] = var[0] + rand() / (double) RAND_MAX - 0.5;
- var[2] = var[1] + rand() / (double) RAND_MAX - 0.5;
- var[3] = var[2] + rand() / (double) RAND_MAX - 0.5;
+ var[0] = (av_lfg_get(&lfg) / (double) UINT_MAX - 0.5) * 2;
+ var[1] = var[0] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
+ var[2] = var[1] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
+ var[3] = var[2] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
av_update_lls(&m, var, 0.99);
av_solve_lls(&m, 0.001, 0);
for (order = 0; order < 3; order++) {