I added in a 3rd screen which I think does what you are asking for.
The randomizer I am using works like this:
[-10…10] creates a list of integers from -10 to 10. This list can be any list of values you want to use. When you use .random(n, seed), it will pick a set of n values from the list. The seed value is the random seed that the randomizer function uses. The value of seed is unimportant, but what is important is that when you change the seed value, the randomizer rerolls. So in the CL, the seed is determined by the action button’s pressCount. So every time the button is pressed, the seed changes, which causes new values to be generated.
When I use .random(1, seed), it is creating a list of 1 element. Since we want to use that value as a number and not a list element, we use the notation that access a value from a list, in this case [1].
As a different example, say I used [1…10].random(5, seed)[3]. That would pick 5 random elements from the set 1 to 10, and then return the 3rd one picked. If I just did [1…10].random(5, seed), that would return a list of the 5 elements.
So whichVar = [0,1].random(1,seed)[1] will create a list of 1 element picked from the set [0,1], and return the first value of that list. Thus this is like flipping a coin.
In the third screen I added in a conditional, which is of the form {condition: value if true, value if false}.
So the new x coordinate is formed liked this:
P
(list of all points so far)
P.x
(list x-coordinates of P)
P.x[length(P)]
(accesses the last element of the list)
P.x[length(P)] + {whichVar = 0: randVal, 0}
(if 0 was selected, add the random value, otherwise add 0).
The newX and newY values are then captured by the button click. Captures fire every time the button is clicked. The history source of a button returns a list of all the captured values. So in the graph component, I am sinking the entire list (using history) into the Xlist and Ylist variables which are then plotted.
I hope that helps explain it! Let me know if you have more questions.