A resampling algorithm is presented for analyzing multiway contingency tables with fixed marginal frequency totals. Applications are illustrated with extensions of Fisher's exact, Pearson's chi-squared, and likelihood-ratio tests to three-way contingency tables.