1
0
Fork 0
Libraries for bc and dc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
389 B

#!/bin/bash
# Use bash's random number feature to seed rand.bc's random number
# generator (bc has no means of generating a seed).
# This script can be used instead of the bc executable to start
# bc when random numbers are required.
TEMPFILE=/tmp/$(basename $0).$$.bc
echo ".=srand($RANDOM.$RANDOM$RANDOM$RANDOM$RANDOM/9)" > $TEMPFILE
\bc "$@" rand/rand.bc $TEMPFILE
\rm -f $TEMPFILE