I would like to pick a 1000 random locations in the human genome (say hg19 assembly) and get a list of the genes closest to them. Can you suggest how I can go about this?
Try the UCSC Genome Browser's mysql databases?
Generate your random intervals from hg19 assembly using bedtools random (documentation) and then use bedtools closest (documentation).
A solution using closest-features in the BEDOPS toolkit: N Closest Genes To A Given Location
I read through the bedtools random documentation. It uses a file hg19.genome. Is this file in bed format and how can I download it?
You can find hg19.genome file here. It is a file with lengths of chromosomes.