# Using a button to reset and rerandomize

**URL:** <https://cl.desmos.com/t/using-a-button-to-reset-and-rerandomize/8313>\
**Category:** Questions\
**Created:** [October 18, 2025, 12:08pm UTC](https://cl.desmos.com/t/using-a-button-to-reset-and-rerandomize/8313 "2025-10-18T12:08:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leslie\_Middleton1](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/leslie_middleton1/32/1771_2.png) [@Leslie\_Middleton1](https://cl.desmos.com/u/Leslie_Middleton1)\
**Post date:** [October 18, 2025, 12:08pm UTC](https://cl.desmos.com/t/using-a-button-to-reset-and-rerandomize/8313/1 "2025-10-18T12:08:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [October 18, 2025, 4:35pm UTC](https://cl.desmos.com/t/using-a-button-to-reset-and-rerandomize/8313/2 "2025-10-18T16:35:14Z")

</div>

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

```auto
R = randomGenerator(yourButtonName.pressCount)

```

---

<div class="post-metadata">

**Author:** ![NTMDev](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ntmdev/32/7141_2.png) [@NTMDev](https://cl.desmos.com/u/NTMDev)\
**Post date:** [October 19, 2025, 12:38am UTC](https://cl.desmos.com/t/using-a-button-to-reset-and-rerandomize/8313/3 "2025-10-19T00:38:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [October 19, 2025, 1:27am UTC](https://cl.desmos.com/t/using-a-button-to-reset-and-rerandomize/8313/4 "2025-10-19T01:27:00Z")

</div>

Nope. Any time you update the seed, it initializes a new generator. Similar to what you can do in a [graph](https://www.desmos.com/calculator/3mzfioqttw) 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.

---

<div class="post-metadata">

**Author:** ![NTMDev](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/ntmdev/32/7141_2.png) [@NTMDev](https://cl.desmos.com/u/NTMDev)\
**Post date:** [October 19, 2025, 2:18am UTC](https://cl.desmos.com/t/using-a-button-to-reset-and-rerandomize/8313/5 "2025-10-19T02:18:39Z")

</div>

Oh I did not know that!
