From 37cf5ebddbac0cdfeef042011658f2e8ce0a32e0 Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Wed, 2 Nov 2011 01:53:39 +0100 Subject: [PATCH] update generate_random --- openmp/merge/generate_random.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/openmp/merge/generate_random.sh b/openmp/merge/generate_random.sh index 5832fe5..706f37c 100755 --- a/openmp/merge/generate_random.sh +++ b/openmp/merge/generate_random.sh @@ -8,7 +8,7 @@ function pwait() { } # 10 ^ x values -X=8 +X=9 NULLEN="" PUNKTE="." for i in $(seq `expr $X - 1`); @@ -16,16 +16,22 @@ do NULLEN="${NULLEN}0" PUNKTE="${PUNKTE}." done +VALUES="1${NULLEN}" -echo "1${NULLEN} values" +BATCH=`expr \( $X \* $VALUES \) / 2` -echo "generating numbers" -echo $(date) -echo ` unsorted1a & -echo ` unsorted1b & -echo ` unsorted2a & -echo ` unsorted2b & +echo "${VALUES} values" +echo "Batch: ${BATCH}" +echo "generating numbers (1)" +echo $(date) +tr -dc 0-9 < /dev/urandom | head -c"${BATCH}" | sed 's/\('$PUNKTE'\)/\1\n/g' > unsorted1a & +tr -dc 0-9 < /dev/urandom | head -c"${BATCH}" | sed 's/\('$PUNKTE'\)/\1\n/g' > unsorted1b & +pwait +echo "generating numbers (2)" +echo $(date) +tr -dc 0-9 < /dev/urandom | head -c"${BATCH}" | sed 's/\('$PUNKTE'\)/\1\n/g' > unsorted2a & +tr -dc 0-9 < /dev/urandom | head -c"${BATCH}" | sed 's/\('$PUNKTE'\)/\1\n/g' > unsorted2b & pwait echo "removing empty lines" @@ -38,9 +44,10 @@ sed '/^$/d' unsorted2b >> unsorted2 echo "formatting numlist" echo $(date) -cat unsorted1 | sort -n | sed -e ':a;N;$!ba;s/\n/,/g' -e 's/^/,/' -e 's/,[0]*/,/g' -e 's/^,/\tint a[] = {/' -e 's/$/,-1};/' >numlist1.c & -cat unsorted2 | sort -n | sed -e ':a;N;$!ba;s/\n/,/g' -e 's/^/,/' -e 's/,[0]*/,/g' -e 's/^,/\tint b[] = {/' -e 's/$/,-1};/' >numlist2.c & +cat unsorted1 | sort -n | sed -e ':a;N;$!ba;s/\n/,/g' -e 's/^/,/' -e 's/,[0]*/,/g' -e 's/^,/\tint a[] = {/' -e 's/{,/{0,/' -e 's/$/,-1};/' >numlist1.c & +cat unsorted2 | sort -n | sed -e ':a;N;$!ba;s/\n/,/g' -e 's/^/,/' -e 's/,[0]*/,/g' -e 's/^,/\tint b[] = {/' -e 's/{,/{0,/' -e 's/$/,-1};/' >numlist2.c & pwait echo "Done." echo $(date) + -- 2.43.0