Multi layer randomization

How can I implement multi-layer randomization?

Yes - once can have hierarchies of Decks to achieve this. So if you have two layers - the first a n allocation to 4 treatments then a second layer to allocate to 3 treatments.
So one scheme might be

Deck A - allocate to one of say 4 conditions

Deck B_1 - allocate to 3 levels when A==1
Deck B_2 - allocate to 3 levels when A==2
Deck B_3 - allocate to 3 levels when A==3
Deck B_4 - allocate to 3 levels when A==4

Then a simplification to access the deck B would be

$local_B = ($DeckB_1 || $DeckB_2 ||$DeckB_3 ||$DeckB_4)