Please supply sample data and code that show what you are trying to accomplish.
The title of this topic includes the phrase "using simulation", but you do not mention simulation in your question. The typical simulation approach to estimate a p-value is
1. Compute a statistic for the observed data
2. Simulate a sample from a known population that is appropriate for the observed data. (aka, simulate from the "null distribution.")
3. Compute the same statistic for the simulated data.
4. Repeat Steps 2-3 many times.
5. Compare the observed statistic to the distribution of the statistics on the simulated samples. The Monte Carlo p-value is the proportion of simulated statistics that are more extreme than the observed statistic.
The same technique is used to estimate a p-value for a bootstrap distribution. For a simulation example, you can see the article on using Monte Carlo simulation to estimate the p-value for the chi-square test.