randline has a local variable, z, that holds the number of
lines in the file. $[RANDOM % z + 1] expands to a random number
between 1 and z. An expression of the form $[...] expands
to the value of the arithmetic expression within the brackets, and the
RANDOM variable returns a random number each time it is
referenced. % is the modulus operator, as in C. Therefore,
sed -n $[RANDOM%z+1]p picks a random line from its input, from 1
to z.

Instead of defining a lot of functions in your `.zshrc', all of
which you may not use, it is often better to use the autoload
builtin. The idea is, you create a directory where function definitions
are stored, declare the names in your `.zshrc', and tell the shell
where to look for them. Whenever you reference a function, the shell
will automatically load it into memory.