Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

random number tip



here's one for the archives...

somewhere (???) i saw a zsh tip for getting random numbers in the range of x-y:
	$[${RANDOM}%1000]     # random between 0-999
	$[${RANDOM}%11+10]    # random between 10-20

but if you need a random number that's N digits long (3 digits, in this example):
	${(l:3::0:)${RANDOM}}


--
        ...atom

 ________________________
 http://atom.smasher.org/
 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
 -------------------------------------------------

	"We will, in fact, be greeted as liberators."
		-- Dick Cheney, 16 March 2003




Messages sorted by: Reverse Date, Date, Thread, Author