#!/bin/sh

# generate ramdom string length 32
ramdomStr() {
  < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-24};echo;
}

ramdomNumber() {
  local min="$1"
  local max="$2"
  [ -z "$min" ] && min=0
  if [ -z "$max" ] || [ "$max" -gt 65536 ] ; then max=65536; fi

  cmd="awk 'BEGIN{srand();print int(rand()*(${max}-${min}))+${min} }'"
  eval $cmd
}
