# Drawing randomly from a set of logarithmically spaced values

**URL:** <https://mworks.discourse.group/t/drawing-randomly-from-a-set-of-logarithmically-spaced-values/720>\
**Category:** Support\
**Created:** [July 30, 2010, 5:10pm UTC](https://mworks.discourse.group/t/drawing-randomly-from-a-set-of-logarithmically-spaced-values/720 "2010-07-30T17:10:41Z")\
**Posts on this page:** 4\
**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:** [July 30, 2010, 5:10pm UTC](https://mworks.discourse.group/t/drawing-randomly-from-a-set-of-logarithmically-spaced-values/720/1 "2010-07-30T17:10:41Z")

</div>

Hi Mark,

The protocol in the attached experiment performs 10 trials. In each trial, the variable `var` is assigned a random element from a set of values equivalent to that returned by the MATLAB code `logspace(0,1,10)`. Each element is used only once, so all the values are used.

The values of `var` are generated using a combination of a range replicator and a variable assignment expression. The range replicator increments the variable `index` from 0 to 9 in steps of 1. Within the replicator body, `var` is set to the expression `pow(10, index/9.0)`. Randomization is achieved by setting the selection scheme of the block to “random without replacement”.

Hopefully, this is close to what you need. If not, please let me know!

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:** [July 30, 2010, 5:10pm UTC](https://mworks.discourse.group/t/drawing-randomly-from-a-set-of-logarithmically-spaced-values/720/2 "2010-07-30T17:10:41Z")

</div>

Attachment: [logspace\_random.xml](https://mworks.discourse.group/uploads/short-url/2iLUquVoh4pHaFJkmGhdXZPax2V.xml) (1.32 KB)

---

<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 30, 2010, 8:11pm UTC](https://mworks.discourse.group/t/drawing-randomly-from-a-set-of-logarithmically-spaced-values/720/3 "2010-07-30T20:11:30Z")

</div>

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:** [July 19, 2022, 11:58pm UTC](https://mworks.discourse.group/t/drawing-randomly-from-a-set-of-logarithmically-spaced-values/720/4 "2022-07-19T23:58:17Z")

</div>

Closed on July 19, 2022, 11:58pm UTC


