Vermona randomRHYTHM - Similar module in VCV?

First time I saw it in VCV was with this module, and it did what I wanted, not playing the same preset/slot twice in a row.

I’ve never noticed that :wink:

1 Like

All the basic pseudo random algorithms I’m aware of can still repeat values, just like a true set of random numbers.

The times I’ve needed to “randomly” sequence a pool of values without any repeats, I create an array of values. I “randomly” select one of the array positions, taking that value. Then I remove that position from the array and randomly select another position from the smaller pool of values. Repeat until all values exhausted.

Not sure if there is a better way to do that, but it has worked for me.

Yeah I think the idea is to allow repeats, but the probability of a repeat is near zero right after the first instance, increasing slowly as time goes on.

There are a lot of different ways to prevent repeats. Your plan works mostly but can actually cause a repeat if the last item in the list is selected first on the next cycle.

My general strategy for no-repeats is to simply store the previous value and then when I generate a random number, if its the same as the previous one, re-generate a new value. Repeat this until the generated value is not the same as the previous one.

That works for preventing direct repeats which is usually good enough. If you need more you can store a list of the last X values and exclude all of them.

Ooh, interesting. I hadn’t thought about that. It may or may not be OK, depending on your goal. You could combine your strategy below with mine to prevent duplicates each time the list is reset.

Yes. What I don’t like about that strategy is the highly variable time it takes to come up with the next random value. If you have a long list, and there are only a few remaining options left, it might take a lot of attempts before success. I used to do a lot of Windows batch programming, which is inherently slow, and that brute force technique simply didn’t cut it.

I’ve never done batch scripting before, so yeah if that is really slow it can be very annoying. Another issue you can run into is an infinite loop if it CAN’T find a solution. But if it can find a solution its really not that bad. I wrote a simple test here that tests 100 sided dice down to a 2 sided dice, and even with the two sided dice its only about 2x the number of rolls and about 5x as long. But that is compare to a pure random. So the time will be better when compared to another solution for removing repeats.

the last squinky labs module, that I never finished, was a rhythm generator that use stochastic production rules to generate rhythms. Maybe I should have finished it…

4 Likes

I forgot to include the link

https://random-demo.glitch.me/

Ooo. Im always interested in fun uses of Stochastic Grammers. I definitely would have fun with that if you finished it.

Have you heard of wave function collapse? GitHub - mxgmn/WaveFunctionCollapse: Bitmap & tilemap generation from a single example with the help of ideas from quantum mechanics