Permuted-block randomization (source code)

= Permuted-block randomization

Within each prespecified <stratum>, choose a block containing fixed equal counts of the two <treatment> assignments, then randomly permute their order. Every completed block gives exact <treatment> balance. Variable block sizes and <allocation concealment> protect against predicting the next assignment. Incomplete final blocks permit a small unavoidable imbalance; odd stratum sizes cannot have exact equal allocation.