[Shell] random number

Hello §e,

I'm trying to get a random number with a shell command (bash, but another shell will be ok). Just for getting the next Euromillion's Jackpot (a random number game in Europe). :)

With Linux, the shuf command does that. I do not have try it (have no Linux), but this link http://www.tux-planet.fr/gagner-au-loto-grace-a-linux/ give the command (for another game).

Something like (adapted for the Euromillion):
echo $(shuf -i 1-50 | head -n5 | sort -n) - $(shuf -i 1-11 | head -n2 | sort -n)

But the shuf command is
Code:
bash: shuf: command not found

Well. Does Somebody know another command?
(the winner will get 1% of my gain - if over a million :beergrin)
 
shuf is part of the GNU coreutils port sysutils/coreutils.

Either, install said port:
cd /usr/ports/sysutils/coreutils; make install clean
echo $(gshuf -i 1-50 | head -n5 | sort -n) - $(gshuf -i 1-11 | head -n2 | sort -n)

Or, if you don't want to buy the whole pork only to get a sausage for one time immediate consumption:
cd /usr/ports/sysutils/coreutils; make
cd work/stage/usr/local/bin
echo $(./gshuf -i 1-50 | head -n5 | sort -n) - $(./gshuf -i 1-11 | head -n2 | sort -n)
cd /usr/ports/sysutils/coreutils; make clean
 
Great. Very thanks you.
A promise is a promise. Don't trash your FreeBSD account for the next 5 years, @obsigna.
If I win you win.

- closed -
 
Last edited by a moderator:
Back
Top