# Use CL to Randomly select from a Graph List (and re-select when button is pressed)

Is there a way to use the CL to tie an action button to the ‘Randomize’ button on the graphing calculator? Or any workaround so that I can get a ‘random’ function on the graphing calculator to re-select a value from a defined list when the student presses the action button?

Here is what I have so far (I just don’t know what to put in the CL to re-randomly select from the lists on the button press): Characteristics of Quadratic Graphs • Activity Builder by Desmos

Ultimately, I want the a, h, and k values of a quadratic function in vertex form to be randomly selected from defined lists (one each for a, h, and k). I also want these values to be reset (and the new parabola to be shown) when students press an action button. I am new to using the CL and would appreciate any suggestions in very simple terms The only way I am aware of doing this is to have a ‘seed’ set within the graph, and have that seed updated by the button press. The `random` (from list) function takes the form `random(list, n, seed)` where n is the amount of numbers you want generated.

Something like `S=0` in the graph, and modify your variables to be `a=random(L_a,1,S)` etc. (this just generates a list of 1 random variable, and selects the first term from that one item list)

Then in CL, you can use `number(`S`): AB1.pressCount` to update the value of the seed, and hence the random values.

2 Likes

Thank you so much for your (timely) response!

I got the screen to do what I was wanting it to do, although I am not sure I fully understand how the `random` function truly operates or what a ‘seed’ is. It’s going to take a lot of practice for me to figure out how all of these cool features work…

I think basically there’s an algorithm to pick “random” values. The seed is essentially an input for that algorithm, so changing it also changes the randomized values.