a package with randomization/permutation tests for genomic analyses
I would simply look at co-variance across the entire dataset and examine values >0.8 in the first instance rather than select 1000 genes. 

With your approach sampling 1000 genes can be criticised for selective sampling and the way to get around this is to perform replicates, with (bootstraps) or without replacement. You could produce e.g. 1000 replicates of 1000 genes and perform co-variance on each replicate to examine Y = X. 

Python has a specific permutation/combinations module call itertools, which is different to random resampling and doesn't need replicates

from itertools import combinations
X = [1,2,3]
Y = [1,2,3]
print (list(combinations(iterable, 1000) + X + Y))




The standard way is to sample is,

from random import sample 
mygenes = [1, 2, 3, 4, 5]  

print(sample(mygenes,3)) 


Output 

[2, 4, 5]


There is nuance and further funcationality ... I cannot remember is "sample" is with or without replacement (its quite a big deal)