# Stratified randomization with permuted-block randomization

I need to create a computer program for randomizing subjects using stratified randomization with permuted-block randomization, so I want to make sure my thinking is correct:

Suppose that in an experiment, there are two groups (control and treatment), and we want to block on two factors: gender (male, female) and race (white, non-white, and asian). Thus, there are $2\times3=6$ strata:

Stratum 1: Male/White
Stratum 2: Male/Non-White
Stratum 3: Male/Asian
Stratum 4: Female/White
Stratum 5: Female/Non-White
Stratum 6: Female/Asian


We are using fixed block sizes of four and an allocation ratio of 1:1, so the six possible allocation sequences are:

AABB, ABAB, ABBA, BBAA, BABA, and BAAB


Now, for every subject, since the subjects are enrolled into the study iteratively (we are expecting $n = 180$), we use the following procedure. Let's say the first subject is female and white.

1. Assign subject to one of six strata. In this example, the subject would be assigned to Stratum 4.
2. Pick a random allocation sequence, e.g., AABB
3. Assign subject to group. If A = control and B = treatment, then the subject is assigned to the control group. The 2nd, 3rd, and 4th subject assigned to Stratum 4 will be assigned to groups A, B, and B, respectively. When the 5th subject is assigned to this stratum, another random block will be chosen, and so on.

The above procedure will be entirely hidden from the user carrying out the data entry, who will only see which group the subject is assigned to.

Is my understanding correct?