diff options
author | Diego Biurrun <diego@biurrun.de> | 2009-03-20 11:48:27 +0000 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2009-03-20 11:48:27 +0000 |
commit | 294eaa26437edf29d866b0bf63d7de57515a0f95 (patch) | |
tree | 605c390daa352a0400dae8422e65af9487f122c4 /libavutil/tree.c | |
parent | c7594e0764d9d41ec4fb6b14deacd3cc6eafc4b3 (diff) | |
download | ffmpeg-294eaa26437edf29d866b0bf63d7de57515a0f95.tar.gz |
Replace random() usage in test programs by av_lfg_*().
Originally committed as revision 18070 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/tree.c')
-rw-r--r-- | libavutil/tree.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavutil/tree.c b/libavutil/tree.c index c9a19fa37d..62437ffd5b 100644 --- a/libavutil/tree.c +++ b/libavutil/tree.c @@ -144,7 +144,9 @@ void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*f)(void *opaque, void #endif #ifdef TEST -#undef random + +#include "lfg.h" + static int check(AVTreeNode *t){ if(t){ int left= check(t->child[0]); @@ -179,9 +181,12 @@ int cmp(const void *a, const void *b){ int main(void){ int i,k; AVTreeNode *root= NULL, *node=NULL; + AVLFG prn; + + av_lfg_init(&prn, 1); for(i=0; i<10000; i++){ - int j= (random()%86294); + int j = av_lfg_get(&prn) % 86294; if(check(root) > 999){ av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i); print(root, 0); @@ -192,7 +197,7 @@ int main(void){ node= av_mallocz(av_tree_node_size); av_tree_insert(&root, (void*)(j+1), cmp, &node); - j= (random()%86294); + j = av_lfg_get(&prn) % 86294; { AVTreeNode *node2=NULL; av_log(NULL, AV_LOG_ERROR, "removing %4d\n", j); |