3 function percent_true ()
7 # If R is uniformly random, then it will be less than a threshold PERCENT of the time.
8 P=$(( $PERCENT * 32786 / 100 ))
11 if [ $R -gt $P ] ; then
18 function random_delay ()
23 P=$(( $R * $MAX / 32786 ))
28 function random_sample ()
31 length=$(wc -l $file | awk '{print $1}')
34 index=$(( $R * $length / $R_MAX ))
36 V=`tail -$(( $length - $index )) $file | head -1`
40 function str_to_state ()
57 exec 3<> /dev/tcp/$1/80
58 echo "GET /index.html HTTP/1.0" 1>&3
61 function close_http ()
64 while read 0<&3; do echo $REPLY >/dev/null; done