These are bootstraping p-values. The second formula on this page here gives a reference where this comes from.
From the source code of the regioneR package (
permTest function) they implement it as:
pval <- (sum(orig.ev >= rand.ev, na.rm = TRUE) + 1) / (num.valid.values + 1)
So the p-value, here testing that the overlap (or whatever you test) is greater for the observed events compared to the randomly-permutated events, is the number of times that the observed event is larger or equal divided by the number of permutations.
The Z-score is the deviation of the observed events by the mean of the permutated events (corrected for standard deviation) so basically a significant event should have a large Z-score since the observed event should be quite different from the mean of the random events.
zscore <- round((orig.ev - mean(rand.ev, na.rm = TRUE))/stats::sd(rand.ev, na.rm = TRUE), 4)