# Multi layer randomization

**URL:** https://forum.surveyengine.com/t/multi-layer-randomization/62
**Category:** Sampling & Quotas
**Tags:** randomization
**Created:** [13 February 2023 18:14 UTC](https://forum.surveyengine.com/t/multi-layer-randomization/62 "2023-02-13T18:14:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Freddo](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.surveyengine.com/freddo/32/55_2.png) [@Freddo](https://forum.surveyengine.com/u/Freddo)
#### Post date: [13 February 2023 18:14 UTC](https://forum.surveyengine.com/t/multi-layer-randomization/62/1 "2023-02-13T18:14:40Z")

</div>

How can I implement multi-layer randomization?

---

<div class="post-metadata">

### Author: ![Nayara](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.surveyengine.com/nayara/32/15_2.png) [@Nayara](https://forum.surveyengine.com/u/Nayara)
#### Post date: [13 February 2023 21:24 UTC](https://forum.surveyengine.com/t/multi-layer-randomization/62/2 "2023-02-13T21:24:11Z")

</div>

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

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

```
