#!/bin/bash # Copyright 2005 Daniel Cer (daniel.cer@cs.colorado.edu) # # This work is licensed under the Creative Commons Attribution-NonCommercial- # ShareAlike License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to # Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, # 94105, USA. randu_state=1 function randu { randu_state=$[(65539*$randu_state)%(2**31)]; randu_ret=$randu_state; } if [ $# -ne 1 ]; then echo -e "Usage:\n\t$0 (number of random values to generate*)" >&2 echo -e "\n* '0' -> unlimited" >&2; exit -1; fi max_iters=$1 if [ `bc<<<"$max_iters + $max_iters >= $max_iters"` -ne 1 ]; then echo "Error: parameter must be a natural number"; exit -2; fi for ((i=0; i