Hi everybody…

Here is a code I have created with “use_random_source” wery well explained in the @mrbombmusic’s video on Youtube:

```
use_bpm 110
with_fx :reverb do
live_loop :a do
use_random_source :perlin
sample :loop_tabla, amp: 2, num_slices: 16, onset: pick, rpitch: rrand(0, 12), cutoff: rrand(60,120) if rand < 0.25
sleep 0.5
end
live_loop :a2 do
use_random_source :white
sample :loop_tabla, amp: 2, num_slices: 16, onset: pick, rpitch: rrand(0, 12), cutoff: rrand(60,120) if rand < 0.50
sleep 0.5
end
live_loop :a3 do
use_random_source :dark_pink
sample :loop_tabla, amp: 2, num_slices: 16, onset: pick, rpitch: rrand(0, 12), cutoff: rrand(60,120) if rand < 0.60
sleep 0.5
end
live_loop :a4 do
use_random_source :light_pink
sample :loop_tabla, amp: 2, num_slices: 16, onset: pick, rpitch: rrand(0, 12),cutoff: rrand(60,120) if rand < 0.70
sleep 0.25
end
end
```

My question: are every random terms (pick, rrand, and if rand) affected by each particular distribution made by “perlin”, “white” etc?

Thanks for helping

Hello @beryann,

To answer your question, yes, all random terms will be affected by the random source you choose.

Just to clarify, you mention “if rand”, but the ‘rand’ is what will return a random value. The ‘if’ is just setting a conditional to run the code if the condition evaluates as true.

Looking at your code, the first loop you have ends with the conditional `if rand < 0.25`

however, if the random source is :perlin, this will not evaluate as true very often because of how this specific random source behaves. This could quite possibly be what you are going for but I thought I’d mention it.

Also, if you are using conditionals that you what to have a specific probability for which could be phrased as “one out of four” which is the same as rand < 0.25 or “one out of two” which is the same as rand < 0.5, you could also consider using the `one_in`

function. This will return true or false based on a specified probability, for example `one_in 2`

would return true with a probability of 1 out of 2 times, `one_in 4`

would return true with a probability of 1 out of 4 times. It will give you the same results but can just be a different way to conceptualize using probability for conditional statements.

Thanks for watching! Always glad to know that people are finding the tutorials to be helpful.

1 Like

hello @mrbombmusic and thanks a lot for this important precision…So for a conditionnal statement what is the “most” efficient or “productiive” random_source? if we search for “interesting” random values? (assuming I’m looking to use use_random_source on multiple patches including conditionals) I hope my question has a clear meaning