Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash random element

function random_element {
  declare -a array=("$@")
  r=$((RANDOM % ${#array[@]}))
  printf "%s
" "${array[$r]}"
}
Source by blog.eduonix.com #
 
PREVIOUS NEXT
Tagged: #bash #random #element
ADD COMMENT
Topic
Name
8+9 =