Suppose a simulator lesson compares two controller configurations using the same set of scenario seeds. Each seed gives a pair of runs, one for each configuration. The goal is to test a paired difference under an appropriate label-swap design. Before opening a statistics package, write down exactly which observations must remain together and which labels could have been swapped. That choice determines the reference distribution in a paired permutation test.
Start with a row for each scenario seed. Preserve the identifiers for both completed runs and the outcome definition. Decide which configuration is subtracted from which, and apply the same order for every row. Check the seed keys for duplicates and missing partners before taking differences. If one member of a pair is missing, describe how that pair will be handled and why. Replacing the missing run with a result from another seed would change the comparison.
The actual experiment needs a reason the two labels are exchangeable within a pair under the proposed null. For example, consider a design where the two assignments could be swapped independently for each seed and the run procedure supports that comparison. If treatment order is fixed and there could be a time trend, a label swap may violate the design. Likewise, repeating a scenario under one shared assignment does not automatically create independent swap opportunities. Keep the unit of assignment in the analysis note. The McNemar example on paired binary outcomes gives another setting where preserving the identity of a pair matters, with a different outcome and statistic.

Take three chosen arithmetic differences for a teaching example. They do not come from the simulator. Swapping the two labels in a pair changes the sign of its difference. With three independent swap choices there are eight sign assignments, including the observed assignment. The statistic here is the arithmetic mean of the signed differences. NumPy documents that mean as the sum of the elements divided by their count. In this small example Python's fraction type makes equal values exactly comparable. NumPy arithmetic mean reference
from fractions import Fraction
from itertools import product
differences = (2, 4, 6)
observed = Fraction(sum(differences), len(differences))
null = [
Fraction(sum(sign * value for sign, value in zip(signs, differences)), len(differences))
for signs in product((-1, 1), repeat=len(differences))
]
extreme = sum(abs(value) >= abs(observed) for value in null)
print(len(null), extreme, Fraction(extreme, len(null)))
The code prints eight assignments, two at least as extreme by absolute mean, and the fraction one quarter. The two extreme assignments retain every sign or reverse every sign. The calculation includes ties because the question explicitly uses at least as extreme. It illustrates a two-sided count for this symmetric arithmetic example. Report the observed statistic and the rule used for the tails together if you adapt the exercise.
Keep repeated values in the reference distribution. Different assignments can yield the same mean, and each assignment still contributes one entry. For instance, a zero difference would produce the same term under either sign. Removing repeated means would change the weights in the tail count. Leave the original vector and the enumerated list beside the example so a reader can see how the denominator was formed.

SciPy documents the samples mode for paired data. When supplied one sample of differences, this mode changes their signs independently. Its pairings mode changes which observations are associated across samples, which can suit an association statistic. Independent reassignment is a separate mode. A run can return a number for any of these modes while answering a different question from the one posed in the assignment record. Before trusting the calculation, show which row associations should survive and compare that rule with the selected mode. SciPy permutation test reference
If the study has too many assignments to enumerate, keep the requested random sample count and randomness setting with the report. Mark a sampled approximation as such. The independent ranks article provides a contrasting case where the two groups are analyzed as independent observations. That choice follows how the data were obtained.
Include the pair key, subtraction order, statistic, tail rule, mode, and whether the reference distribution was fully enumerated. Give a colleague the tiny arithmetic check first, then have them inspect the actual study's assignment record. This separates a reproducible implementation check from the design question. For related statistical examples, see the industry analysis section and the industry news archive. The allocation rule is what lets a reader tell whether a result pertains to the paired robot trial that was planned.