Random function question

Hi everyone.
I’m trying to create a randomness function in a Patch to randomize the value of some parameters.
The idea is to create a button that sends a fixed value between 0 to 1 when you press it. I checked the Random node but I don’t know if exist a way to control it and tell him when he should send a new value.
Thanks in advance!!

Welcome to the Forum @jjos. Glad you could join us! The random node continuously generates random values between 0 and 1 (noise). In order to get a specific random value on-demand, connect the random node to the input of a Sample and Hold node. When you trigger the S&H the output will be a random value.
Screen Shot 2021-02-25 at 12.52.10 PM
The random node actually produces the same series of random numbers every time it is loaded. If this presents a problem you can change the seed value which will change the random sequence. Generally this only matters when you are using multiple random nodes in a patch.

2 Likes

Thanks a lot! I’m going to try it right away :slight_smile:

Is possible to save the Seed setting of the random node with the patch?

The seed value will be saved with the patch.

Umm. Everytime I load the patch the seed value comes back to 0. I’m on the ios version.

I just tested it and it seems to save fine for me on both iOS and macOS. Try creating a blank patch, adding a random node, changing the seed value then closing the patch. Re-open the patch and see if it has reset. For me it stays at whatever value I’ve set it to.

1 Like

Is working with an empty patch. Thanks!

1 Like