Calculates exact p-values for permutation tests when permutations are randomly
drawn with replacement. This implementation is based on
(slightly adapted) the implementation by Belinda Phipson and Gordon Smyth
from the R package statmod
References
Phipson B, and Smyth GK (2010). Permutation p-values should never be zero: calculating exact p-values when permutations are randomly drawn. Statistical Applications in Genetics and Molecular Biology, Volume 9, Issue 1, Article 39. http://www.statsci.org/smyth/pubs/PermPValuesPreprint.pdf