How to randomly ramp between numbers and ramp from the last number?

Benson's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I want to ramp between the numbers: 80, 100, 125, 140 and 175.

My patch currently does this but I want every new sequence bang to start from the resulting number that is banged out. E.g. If it bangs out 100, I want it to ramp up or down from 100 to another one of the numbers above on the next bang of the sequence.

Again, for example, if I bang the sequence and it ramps between 140-175, I want the next sequence to start from 175 and ramp down from 175 to one of the lower numbers like 125.

Any help would be very much appreciated!

Ben Bracken's icon

The line object will remember where it is, so there is no need to 'set' the initial value each time the message boxes get banged, as you are doing in your patch.

Max Patch
Copy patch and select New From Clipboard in Max.

This should do what you want:

Benson's icon

Thank you Ben that's great!
Just one thing though, sometimes it randomly selects the same number, any idea how to get it to randomly select a unique number EVERY time?

mizu's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hi Benson
my 2c
zz