# Weighted probabilities for events?

**URL:** <https://uzu.lurk.org/t/weighted-probabilities-for-events/3749>\
**Category:** Uncategorized\
**Created:** [26 December 2021 12:01 UTC](https://uzu.lurk.org/t/weighted-probabilities-for-events/3749 "2021-12-26T12:01:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flechtwerk](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@flechtwerk](https://uzu.lurk.org/u/flechtwerk)\
**Post date:** [26 December 2021 12:01 UTC](https://uzu.lurk.org/t/weighted-probabilities-for-events/3749/1 "2021-12-26T12:01:25Z")

</div>

Hello everyone,

I'm failry new to Tidal, so please excuse me if the answer is somewhat obvious - but is it possible to set probability values for events in a pattern? Similar to SuperCollider's Pwrand class, where you can specify an array of values (e.g. [0,2,3]) and then set the respective probability of their occurence via a second array (e.g. [0.75,0.15,0.1]).

I just find myself writing something like "0|0|0|1" quite often and am wondering whether there is a more elegant solution.

---

<div class="post-metadata">

**Author:** ![ndr\_brt](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ndr_brt/32/396_2.png) [@ndr\_brt](https://uzu.lurk.org/u/ndr_brt)\
**Post date:** [26 December 2021 14:03 UTC](https://uzu.lurk.org/t/weighted-probabilities-for-events/3749/2 "2021-12-26T14:03:17Z")

</div>

The function you are looking for is wchoose:  
[https://tidalcycles.org/docs/patternlib/tour/conditions/#wchoose](https://tidalcycles.org/docs/patternlib/tour/conditions/#wchoose)

---

<div class="post-metadata">

**Author:** ![flechtwerk](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@flechtwerk](https://uzu.lurk.org/u/flechtwerk)\
**Post date:** [26 December 2021 17:55 UTC](https://uzu.lurk.org/t/weighted-probabilities-for-events/3749/3 "2021-12-26T17:55:11Z")

</div>

Thank you - this seems to be exactly what I was looking for.

---

<div class="post-metadata">

**Author:** ![cleary](https://uzu.lurk.org/user_avatar/uzu.lurk.org/cleary/32/177_2.png) [@cleary](https://uzu.lurk.org/u/cleary)\
**Post date:** [26 December 2021 20:45 UTC](https://uzu.lurk.org/t/weighted-probabilities-for-events/3749/4 "2021-12-26T20:45:44Z")

</div>

> [@flechtwerk](#):
>
> "0|0|0|1"

This may be ugly/inelegant, but very short/quick. I far more frequently use this syntax over `wchoose` 😅
