make rand_pathname only generate a max of 4k

Otherwise, on systems where page size > 4k, we'd still have the buffer
overflows when trying to print these buffers in output()