working on fakevalues generator

This commit is contained in:
tth 2018-12-13 19:39:06 +01:00
parent 54846f5041
commit 639adde484
2 changed files with 25 additions and 2 deletions

View File

@ -4,7 +4,7 @@ DATAFILE=/tmp/fake-datafile
#----- collect the datas #----- collect the datas
> ${DATAFILE} > ${DATAFILE}
for s in $(seq 1 20) for s in $(seq 1 2000)
do do
v=$(./fake-values -s -t 1 2> /dev/null) v=$(./fake-values -s -t 1 2> /dev/null)
echo $s $v >> ${DATAFILE} echo $s $v >> ${DATAFILE}
@ -13,7 +13,19 @@ done
#----- do dome useless computations #----- do dome useless computations
awk ' awk '
NR==1 { debut = $2 } NR==1 { debut = $2 }
{ print $2-debut, $3 } {
# print $2-debut, $3
v = int($3/25);
bucket[v]++;
}
END {
for (v=0; v<40; v++) {
for (foo=0; foo<bucket[v]; foo++) {
printf "-";
}
print "*"
}
}
' \ ' \
< ${DATAFILE} < ${DATAFILE}

11
funcs.c
View File

@ -3,14 +3,25 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include "funcs.h" #include "funcs.h"
extern int verbosity; extern int verbosity;
/* --------------------------------------------------------------- */
int seed_my_rand(int foo)
{
long v1, v2;
v1 = getpid(); v2 = time(NULL);
return v1 ^ v2;
}
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
int random1000(int type) int random1000(int type)