Using a button to reset and rerandomize

I would like to create a test that chooses from a set of random problems and then at the end I want students to be able to push a button that clears their answers and then rerandomizes the questions.

I know how to do the random thing with the random generator.

So my thoughts are that on one of my first screens I will have in the CL

R=randomGenerator()

A=r.int(1,10)

Then on subsequent screens have a bank of 10 questions in the CL and whatever number is chosen then that is the test that is created.

Ideally if I could do the randomization for eacb screen then I would be able to get more versions but I think for simplicity sake, I will just do the randomization once and be happy wirh 10 versions.

Can anyone help me with how I would code a button to redo the randomization?

randomGenerator() also takes a seed value, so you can add the button’s pressCount to reroll it.

R = randomGenerator(yourButtonName.pressCount)

But wouldn’t R = randomGenerator just give the same output every time? Isn’t a random generator’s seed initialized and permanent when it was created?

Nope. Any time you update the seed, it initializes a new generator. Similar to what you can do in a graph with a variety of list functions. Although one notable difference between using seeds in graphs and in CL, graphs will yield the same results for each student for the same seeds, while CL will return different values for the same seeds.

Oh I did not know that!