[Swift-commit] r6696 - SwiftTutorials/tukey
ketan at ci.uchicago.edu
ketan at ci.uchicago.edu
Thu Aug 1 13:28:57 CDT 2013
Author: ketan
Date: 2013-08-01 13:28:56 -0500 (Thu, 01 Aug 2013)
New Revision: 6696
Added:
SwiftTutorials/tukey/simulate.sh
SwiftTutorials/tukey/stats.sh
Log:
adding scripts for tukey
Added: SwiftTutorials/tukey/simulate.sh
===================================================================
--- SwiftTutorials/tukey/simulate.sh (rev 0)
+++ SwiftTutorials/tukey/simulate.sh 2013-08-01 18:28:56 UTC (rev 6696)
@@ -0,0 +1,23 @@
+#! /bin/bash
+
+runtime=${1:-0}
+range=${2:-100}
+biasfile=${3:-nobias}
+scale=${4:-1}
+n=${5:-1}
+
+if [ $biasfile = nobias ]; then
+ offset=0
+else
+ read offset <$biasfile
+fi
+
+# run for some number of "timesteps"
+
+sleep $runtime
+
+# emit n "simulation results", scaled and biased by the specified argument values
+
+for ((i=0;i<n;i++)); do
+ echo $(( ($RANDOM%range)*scale+offset))
+done
Property changes on: SwiftTutorials/tukey/simulate.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: SwiftTutorials/tukey/stats.sh
===================================================================
--- SwiftTutorials/tukey/stats.sh (rev 0)
+++ SwiftTutorials/tukey/stats.sh 2013-08-01 18:28:56 UTC (rev 6696)
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+awk '
+
+{ sum += $1}
+
+END { print sum/NR }
+' $*
+
Property changes on: SwiftTutorials/tukey/stats.sh
___________________________________________________________________
Added: svn:executable
+ *
More information about the Swift-commit
mailing list