# Incrementing the range of a selection variable

**URL:** <https://mworks.discourse.group/t/incrementing-the-range-of-a-selection-variable/615>\
**Category:** Support\
**Created:** [August 9, 2013, 9:18pm UTC](https://mworks.discourse.group/t/incrementing-the-range-of-a-selection-variable/615 "2013-08-09T21:18:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [August 9, 2013, 9:18pm UTC](https://mworks.discourse.group/t/incrementing-the-range-of-a-selection-variable/615/1 "2013-08-09T21:18:36Z")

</div>

Hi Chris,  
I was wondering if there’s a smart way to increment the range of a selection variable. I’d like to have blocks of trials where a variable is selected randomly from 0:n for block n. I could do this with just normal variables and rand() but I figured there’s probably some advantage to using selection variables.

In particular, it’d be nice if the selection variable wasn’t reinitialized, so that the “next selection” is biased away from the previous block’s selections. For instance, in block 1, the variable is set to 0 or 1, and in block 2, it will get selected as 2 more often than 0/1 so that all 3 values get selected approximately equally times in total. Once again, I could hardcode this with normal variables and some distribution on rand(), but I’m wondering if there’s a clever way of doing it. Let me know!  
Thanks,  
Rishi

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [August 13, 2013, 1:37pm UTC](https://mworks.discourse.group/t/incrementing-the-range-of-a-selection-variable/615/2 "2013-08-13T13:37:46Z")

</div>

Hi Rishi,

It’s not immediately obvious to me if/how you could do this with selection variables. Let me think about it a bit and get back to you.

Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 23, 2013, 2:47pm UTC](https://mworks.discourse.group/t/incrementing-the-range-of-a-selection-variable/615/3 "2013-09-23T14:47:20Z")

</div>

Hi Rishi,

I still don’t see any way to make this work with selection variables. It might be possible to get the behavior you want with normal variables and rand(), though I’m not fully convinced yet. Alternatively, it could be done with the aid of a Python bridge script or (as a last resort) a custom plugin. Should I explore those options further, or are you content with your current workaround(s)?

Thanks,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [September 23, 2013, 4:55pm UTC](https://mworks.discourse.group/t/incrementing-the-range-of-a-selection-variable/615/4 "2013-09-23T16:55:58Z")

</div>

Hi Chris,  
Thanks. No need to explore workarounds, I’m satisfied with the current  
method.  
Best  
Rishi

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 19, 2022, 11:26pm UTC](https://mworks.discourse.group/t/incrementing-the-range-of-a-selection-variable/615/5 "2022-07-19T23:26:59Z")

</div>


