Skip to content

Instantly share code, notes, and snippets.

@tmhedberg
Created May 13, 2011 16:07
Show Gist options
  • Save tmhedberg/970811 to your computer and use it in GitHub Desktop.
Save tmhedberg/970811 to your computer and use it in GitHub Desktop.
Generate a pseudorandom signed integer
#!/bin/bash
[[ $# -lt 1 ]] &&
B=8 ||
B=$1
dd if=/dev/urandom bs=1 count="$B" 2>/dev/null |
od -A n -t d"$B" |
sed 's/^[[:space:]]*//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment