Randomization methods
The three methods Randomizer offers, each stated as a rule for the probability of the next assignment, with its balance and predictability and the published work it rests on. Use it to choose a method, to describe it in a protocol, or to check what the software does.
Notation
A study has groups in the allocation ratio of positive integers. The target share of group is
so 1:3:2 gives shares 1/6, 1/2 and 1/3. Participants are randomized one at a time, in the order they enroll. Write for the group of participant . After participants,
- is the number of the first participants in group ,
- is how far group is from its target, positive when over,
- is 1 when the condition inside holds and 0 otherwise.
Each method is defined by its allocation probabilities
- is everything known before participant is randomized: the earlier assignments, the earlier participants' factor levels, and the new participant's own.
Each method is judged on two properties. Balance is how far can stray from 0. Predictability is how well someone who knows can guess . A rule with whatever the history can't be predicted but can drift out of balance. A rule that steers every back to 0 stays balanced but becomes predictable. Every restricted method trades one for the other
Simple randomization
Each participant's group is drawn independently of everyone else's
Allocation rule
Factor levels are recorded but play no part.
Balance
The assignments are independent and identically distributed, so each group's size is binomial
The groups match the ratio only on average. The standard deviation of grows like , while the share shrinks like : with 1:1 and , each group's size has standard deviation 5. For two groups at 1:1, the chance that the larger one holds at least a share of the participants is
- runs over the possible sizes 0 to of group 1,
- is the share that counts as imbalanced, here 0.6.
| Participants | Chance |
|---|---|
| 10 | 75.4% |
| 20 | 50.3% |
| 50 | 20.3% |
| 100 | 5.7% |
| 200 | 0.6% |
| 500 | < 0.1% |
Imbalance is a real risk in small studies and negligible in large ones. Since is a random walk, the groups can also drift apart for long stretches, which matters if participants enrolled early differ from those enrolled late
Predictability
Let the guess be any function of . Then
with equality for always guessing the largest group. The history doesn't help: with 1:1, every strategy is right exactly half the time. In Blackwell and Hodges' model of selection bias there is nothing to exploit
Permuted block randomization
Participants are assigned in consecutive blocks. Each block holds every group in exactly the target ratio, in random order, so the groups return to the ratio at the end of every block
Allocation rule
A block of size , a multiple of , has
places for group : 2 and 4 for 1:2 in blocks of 6. Its order is drawn uniformly from the
distinct sequences with those counts: 6 for 1:1 in blocks of 4 (AABB, ABAB, ABBA, BAAB, BABA, BBAA), 20 in blocks of 6, 15 for 1:2 in blocks of 6, and 90 for 1:1:1 in blocks of 6. A uniformly random shuffle of the places, such as the Fisher–Yates shuffle, gives exactly this distribution
Equivalently, the block is drawn without replacement from an urn holding balls for each group . For a participant who comes after others in the current block,
- is the size of the current block,
- is how many of its places are filled, ,
- is how many of those went to group , so places are left for it.
Random block sizes
Each block's size is drawn independently from the allowed sizes:
- is an allowed block size, a multiple of ,
- is its weight, a positive integer,
- is the number of allowed sizes.
The default is with equal weights, so blocks of 4 or 6 for 1:1. Varying the size at random makes it much harder to tell where one block ends and the next begins
Balance
at the end of every block. Within a block,
- is the largest allowed block size.
Since the earlier blocks are complete, . The excess is largest when group 's places all come first: gives . The shortfall is largest when they all come last: and give . Both equal . For two groups at 1:1 this means at every point in the study. If enrollment stops partway through a block, the final groups can be off the ratio by up to this bound.
Predictability
Someone who knows the earlier assignments and the block size does best by guessing the group with the most places left
- is the expected share of assignments guessed right,
- is the expected share known for certain,
- is the length of the run of one group that ends the block; the fraction is the chance that this run has length exactly , and its assignments are the certain ones.
| Block size | Possible orders | Guessed right | Known for certain |
|---|---|---|---|
| 2 | 2 | 75% | 50% |
| 4 | 6 | 70.8% | 33.3% |
| 6 | 20 | 68.3% | 25% |
| 8 | 70 | 66.6% | 20% |
| 10 | 252 | 65.3% | 16.7% |
Simple randomization has and . Random block sizes lower both, since a guesser no longer knows or where a block ends. They don't remove predictability altogether: every restricted method trades some of it for balance
Strata
In a stratified study, each of the strata (every combination of factor levels, such as Boston · Female) runs its own, independent sequence of blocks, so the groups are balanced within each stratum. The study-wide imbalance is the sum of the strata's,
- is the number of strata (see Stratification factors),
- is the number of participants so far in stratum ,
- is group 's departure from target within stratum .
With many strata and few participants in each, most blocks are never finished and the balance blocking was meant to give is lost
Minimization
Minimization assigns each participant, with high probability, to the group that leaves their own factor levels most balanced across the whole study. Taves introduced it as a deterministic rule
Allocation rule
Arms. Let be the reduced ratio. Group is split into arms of equal ratio, giving arms in all, and is the group of arm . 1:1 and 2:2 give two arms; 2:1 gives three, A₁, A₂ and B. Unequal ratios explains why.
Counts. There are factors, and factor has levels . Before participant ,
- is participant 's level of factor ,
- is participant 's arm,
- is how many earlier participants with level of factor are in arm .
Scores. Each arm is scored by the imbalance it would leave in participant 's own levels:
- is the unit vector with 1 in position , so are the counts if the participant joins arm ,
- is the imbalance measure, which maps counts to a number that is 0 when they are all equal (see Imbalance measures).
Every factor weighs the same, and levels the participant doesn't have don't enter. With no factors, on the arm totals , which balances the group sizes.
Choice. Split the arms into the best and the rest,
and pick arm with probability
- is the preferred probability, the chance of picking from the best arms, from 1/2 to 1 and 0.8 by default,
- are the numbers of arms in each set.
The participant joins the group of the chosen arm, so , and the arm's count goes up by one in each of their levels. Unlike stratified blocks, there is one set of counts for the whole study.
Imbalance measures
Pocock and Simon left the measure of imbalance open. The range and the variance are the usual choices
- is the population variance of the counts, , and is their mean.
The factor is the same for every arm and factor, so it changes no comparison, and it makes a whole number for whole-number counts. For counts (2, 1, 1), . The range looks only at the largest and smallest counts; the variance counts every arm, which matters with three or more. With two arms, . The variance is the default.
Continuous factors
Binning a continuous factor like age throws information away: an 18-year-old and a 29-year-old in the same bin count alike, so the groups' mean ages can drift apart within every bin. By default, minimization balances a continuous factor on its values instead, through its first two moments. Bins remain an option.
Let be the factor's values for participants 1 to , the new participant included. Standardize them with their mean and standard deviation,
and apply the first three normalized Hermite polynomials,
summed over each arm's earlier participants:
The factor then adds to the score , in place of a level's ,
- are the mean and population standard deviation of all values, recomputed for every new participant,
- is the new participant's standardized value,
- is the number of earlier participants in arm ,
- is 0 for every arm when every arm's mean is ,
- is 0 for every arm when every arm's mean square deviation from is .
The three functions are orthonormal under the standard normal distribution: for . So for normally distributed values the three contributions are uncorrelated and on the same scale, and none outweighs the others. Dividing by 3 makes the factor weigh as much as a factor with levels. When , before the values vary, only the term is scored.
Since and change with every participant, the sums are recomputed each time, from three running sums per arm:
- is the number of earlier participants in arm , which is ,
- is the sum of their values,
- is the sum of their squared values.
The analysis can then adjust for the value itself rather than its bin, so nothing is lost to the cut points.
The preferred probability
- always picks a best arm, so chance settles only ties: Taves's original method
[25] . Anyone who knows the counts can then predict most assignments, and reviews recommend keeping a random element[24] . - with gives whatever the scores: simple randomization.
- With and no factors, the rule is Efron's biased coin
[7] : the smaller group gets probability , and a tie gives each group 1/2. Efron suggested .
Unequal ratios
With unequal allocation, minimizing over the groups directly pulls them toward equal sizes. Ad hoc fixes can make each group's probability drift away from the target from one assignment to the next, which distorts the re-randomization distribution used to analyse the trial
where the probability is unconditional, taken over every possible history.
Minimization over arms has this property. Relabelling the arms by any permutation relabels the scores, the sets and and the probabilities in the same way, and all counts start at zero. So the distribution of the sequence of arms is unchanged by relabelling, each arm has unconditional probability at every step, and
Balancing the arms then holds each factor level's groups near the ratio. Han, Enas and McEntegart, and Kuznetsova and Tymofyeyev, describe other approaches
Worked example
Two groups at 1:1, so ; factors Site (Boston, Chicago) and Sex (Female, Male); ; . The next participant is a woman in Boston, and so far and .
| Arm | |||
|---|---|---|---|
| A | (6, 3), range 3 | (5, 3), range 2 | 5 |
| B | (5, 4), range 1 | (4, 4), range 0 | 1 |
So , and the participant goes to B with probability 0.8 and to A with 0.2. Chicago and Male don't enter, since only the participant's own levels are scored. With the scores are and , and the choice is the same.
With 2:1 instead, the arms are A₁, A₂ and B. Before anyone enrolls all three score the same, so , each arm has probability 1/3 and group A has 2/3.
As with stratified blocks, analyses should adjust for the minimization factors
Stratification factors
Each participant has one level of each of factors. With levels in factor , the number of strata is
so three factors of three levels make 27. A study with sites can also be stratified by site, which adds site as a factor.
Continuous factors in bins
A whole-number factor like age, with values from to , can be split into bins of near-equal width. Divide the number of values by the number of bins,
Bin then holds the values from to , where
- is the number of possible values,
- is the width every bin has at least,
- is the number of bins, the first ones, that hold one value more.
Ages 18 to 64 in four bins give , so 18–29, 30–41, 42–53 and 54–64. Minimization can balance on the values instead; see Continuous factors.
How each method uses them
- Simple randomization records them but ignores them.
- Permuted blocks run a separate block sequence in each stratum.
- Minimization balances each factor's levels across the whole study, and continuous factors by value or by bin.
Randomizing sites
A study can randomize whole sites instead of participants (cluster randomization). Every formula above then applies with sites in place of participants: counts sites, the factors describe sites (region or size, say), and each site is randomized once, when it's added. Every participant at a site takes the site's group.
Participants at one site tend to be more alike than participants at different sites, so a cluster trial needs more participants than an individually randomized one, by the design effect
- is the number of participants per site, taken as equal,
- is the intracluster correlation.
The analysis must allow for the clustering
Choosing a method
| Method | Group sizes | Factors | Predictability |
|---|---|---|---|
| Simple | , uneven in small studies | Balanced on average | None |
| Permuted blocks | for 1:1, in each stratum | Balanced within strata, if strata are few | Some, reduced by random block sizes |
| Minimization | Close to the ratio | Each factor balanced across the study, even with many | Some, set by |
- Simple randomization suits large studies, where chance imbalance is small and complete unpredictability is worth most.
- Permuted blocks are the usual choice for small and medium studies, stratified by one or two important factors such as site.
- Minimization suits small studies that must balance several factors at once.
Implementation
What a protocol or an audit may need beyond the definitions above.
- Random numbers. Every draw is Node.js's
crypto.randomInt(m), uniform on from the operating system's cryptographically secure generator, without modulo bias[18] . Ratios, block-size weights and (set in whole percent) are whole numbers, so every probability above is realized exactly: a draw on picks group for exactly of its values. Shuffles use Durstenfeld's version of Fisher–Yates. - Concealment. Each participant is assigned when they enroll, on the server; no list is generated in advance. The rest of the current block and the minimization counts are kept where no user or browser can read them, so the people enrolling can't know the next group before a participant is committed
[23] . Enrollments made at the same moment are handled one after another, each seeing the state the previous one left. - Ties. With continuous factors the scores aren't whole numbers, so arms within a relative of the lowest score count as tied.
- Changes mid-study. A block that no longer fits changed ratios or block sizes is abandoned and a new one started. In minimization, each group's counts are spread over its new arms.
- Limits. 2 to 10 groups, with ratio shares from 1 to 99; up to 10 block sizes from 2 to 1,000, with weights from 1 to 99; up to 10 factors of 2 to 10 levels; and from 50% to 100%. Once the target sample size is randomized across all strata, enrollment is refused.
- Who sees the settings. Every member of a project can see the allowed block sizes and weights. In an unblinded study, use more than one size, and don't share them with the people enrolling.
- Reporting. CONSORT 2025 asks trial reports to state how the allocation sequence was generated, the type of randomization and any restriction, such as blocking or stratification, and how allocation was concealed
[11] .
References
- Altman DG, Bland JM. How to randomise. BMJ. 1999;319(7211):703–4. https://doi.org/10.1136/bmj.319.7211.703
- Altman DG, Bland JM. Treatment allocation by minimisation. BMJ. 2005;330(7495):843. https://doi.org/10.1136/bmj.330.7495.843
- Berger VW, Ivanova A, Deloria Knoll M. Minimizing predictability while retaining balance through the use of less restrictive randomization procedures. Stat Med. 2003;22(19):3017–28. https://doi.org/10.1002/sim.1538
- Blackwell D, Hodges JL. Design for the control of selection bias. Ann Math Stat. 1957;28(2):449–60. https://doi.org/10.1214/aoms/1177706973
- Campbell MK, Piaggio G, Elbourne DR, Altman DG. Consort 2010 statement: extension to cluster randomised trials. BMJ. 2012;345:e5661. https://doi.org/10.1136/bmj.e5661
- Durstenfeld R. Algorithm 235: Random permutation. Commun ACM. 1964;7(7):420. https://doi.org/10.1145/364520.364540
- Efron B. Forcing a sequential experiment to be balanced. Biometrika. 1971;58(3):403–17. https://doi.org/10.1093/biomet/58.3.403
- Fisher RA, Yates F. Statistical tables for biological, agricultural and medical research. London: Oliver and Boyd; 1938.
- Hallstrom A, Davis K. Imbalance in treatment assignments in stratified blocked randomization. Control Clin Trials. 1988;9(4):375–82. https://doi.org/10.1016/0197-2456(88)90050-5
- Han B, Enas NH, McEntegart D. Randomization by minimization for unbalanced treatment allocation. Stat Med. 2009;28(27):3329–46. https://doi.org/10.1002/sim.3710
- Hopewell S, Chan AW, Collins GS, et al. CONSORT 2025 statement: updated guideline for reporting randomised trials. BMJ. 2025;389:e081123. https://doi.org/10.1136/bmj-2024-081123
- Kahan BC, Morris TP. Improper analysis of trials randomised using stratified blocks or minimisation. Stat Med. 2012;31(4):328–40. https://doi.org/10.1002/sim.4431
- Kernan WN, Viscoli CM, Makuch RW, Brass LM, Horwitz RI. Stratified randomization for clinical trials. J Clin Epidemiol. 1999;52(1):19–26. https://doi.org/10.1016/S0895-4356(98)00138-3
- Kuznetsova OM, Tymofyeyev Y. Preserving the allocation ratio at every allocation with biased coin randomization and minimization in studies with unequal allocation. Stat Med. 2012;31(8):701–23. https://doi.org/10.1002/sim.4447
- Lachin JM. Statistical properties of randomization in clinical trials. Control Clin Trials. 1988;9(4):289–311. https://doi.org/10.1016/0197-2456(88)90045-1
- Lachin JM. Properties of simple randomization in clinical trials. Control Clin Trials. 1988;9(4):312–26. https://doi.org/10.1016/0197-2456(88)90046-3
- Matts JP, Lachin JM. Properties of permuted-block randomization in clinical trials. Control Clin Trials. 1988;9(4):327–44. https://doi.org/10.1016/0197-2456(88)90047-5
- Node.js. Crypto: crypto.randomInt([min, ]max[, callback]). Node.js documentation. https://nodejs.org/api/crypto.html#cryptorandomintmin-max-callback
- Pocock SJ, Simon R. Sequential treatment assignment with balancing for prognostic factors in the controlled clinical trial. Biometrics. 1975;31(1):103–15. https://doi.org/10.2307/2529712
- Proschan M, Brittain E, Kammerman L. Minimize the use of minimization with unequal allocation. Biometrics. 2011;67(3):1135–41. https://doi.org/10.1111/j.1541-0420.2010.01545.x
- Rosenberger WF, Lachin JM. Randomization in clinical trials: theory and practice. 2nd ed. Hoboken (NJ): Wiley; 2016. https://doi.org/10.1002/9781118742112
- Schulz KF, Grimes DA. Generation of allocation sequences in randomised trials: chance, not choice. Lancet. 2002;359(9305):515–9. https://doi.org/10.1016/S0140-6736(02)07683-3
- Schulz KF, Grimes DA. Allocation concealment in randomised trials: defending against deciphering. Lancet. 2002;359(9306):614–8. https://doi.org/10.1016/S0140-6736(02)07750-4
- Scott NW, McPherson GC, Ramsay CR, Campbell MK. The method of minimization for allocation to clinical trials: a review. Control Clin Trials. 2002;23(6):662–74. https://doi.org/10.1016/S0197-2456(02)00242-8
- Taves DR. Minimization: a new method of assigning patients to treatment and control groups. Clin Pharmacol Ther. 1974;15(5):443–53. https://doi.org/10.1002/cpt1974155443
- Zelen M. The randomization and stratification of patients to clinical trials. J Chronic Dis. 1974;27(7–8):365–75. https://doi.org/10.1016/0021-9681(74)90015-0