# Correct sink using random generated problems

**URL:** <https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193>\
**Category:** Questions\
**Tags:** dashboard, validation, correctness\
**Created:** [April 28, 2021, 3:12pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193 "2021-04-28T15:12:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pamela\_Davis](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/pamela_davis/32/1890_2.png) [@Pamela\_Davis](https://cl.desmos.com/u/Pamela_Davis)\
**Post date:** [April 28, 2021, 3:12pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/1 "2021-04-28T15:12:28Z")

</div>

I have copied some CLD from other activities to get random generated equations but I am trying to figure out how to set the correct sink in the math text to be able to see the check mark on the teacher dashboard. Can someone help me with slide 2 and 3 for: [TQR - Solving Systems of Equation Exam • Activity by Pamela Davis](https://teacher.desmos.com/activitybuilder/custom/608889ef662ada05768d295c)

Thank you!

---

<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:** [April 28, 2021, 5:10pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/2 "2021-04-28T17:10:58Z")

</div>

a and b from component, q2, are Booleans, not the actual coordinates. This should work for your input instead:

```auto
a = q2.script.a
b = q2.script.b

correct: a and b

```

---

<div class="post-metadata">

**Author:** ![Pamela\_Davis](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/pamela_davis/32/1890_2.png) [@Pamela\_Davis](https://cl.desmos.com/u/Pamela_Davis)\
**Post date:** [May 5, 2021, 1:47pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/3 "2021-05-05T13:47:40Z")

</div>

I have a new problem but it is sort of similar to the previous question. I am using a random generator to randomly choose between different problems. Based on which problem the student gets will determine which answer is correct. I have the note screen programmed but can’t figure out how to get the Math Text box to check for correct and get a check mark on the teacher dashboard. Here’s the coding for my Notes box:

r = randomGenerator()  
d1 = r.int(1,5)

q6 = `f\left(x\right)=\frac{4x^{4}-5}{4x^{4}+3}`  
q7 = `f\left(x\right)=\frac{5x^{5}+3x^{4}}{5x^{2}+4}`  
q8 = `f\left(x\right)=\frac{4x^{5}+3x^{2}}{x^{2}-5}`  
q9 = `f\left(x\right)=\frac{5x^{5}+4x^{4}}{x^{4}-4}`  
q10 = `f\left(x\right)=\frac{4x^{4}+x^{2}}{x^{2}+4}`

equation = when d1 = 1 `${q6}` when d1 = 2 `${q7}` when d1 = 3 `${q8}` when d1 = 4 `${q9}` when d1 = 5 `${q10}` otherwise “”

content:  
"Differentiate: ${equation}

"

hidden: timer15.timeSincePress(10)=0

a6 = `f'\left(x\right)=\frac{128x^{3}}{16x^{8}+24x^{4}+9}`  
a7 = `f'\left(x\right)=\frac{75x^{6}+30x^{5}+100x^{4}+48x^{3}}{25x^{4}+40x^{2}+16}`  
a8 = `f'\left(x\right)=\frac{12x^{6}-100x^{4}-30x}{x^{4}-10x^{2}+25}`  
a9 = `f'\left(x\right)=\frac{5x^{8}-100x^{4}-64x^{3}}{x^{8}-8x^{4}+16}`  
a10 = `f'\left(x\right)=\frac{8x^{5}+64x^{3}+8x}{x^{4}+8x^{2}+16}`

correct = when d1 = 1 `${a6}` when d1 = 2 `${a7}` when d1 = 3 `${a8}` when d1 = 4 `${a9}` when d1 = 5 `${a10}` otherwise “”

---

<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:** [May 5, 2021, 4:34pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/4 "2021-05-05T16:34:25Z")

</div>

As long as your variable `correct` is functioning, you just a correct sink in your math input. If that variable was defined in the math input:

```auto
correct: correct

```

If it’s defined in a different component:

```auto
correct: componentName.script.correct

```

---

<div class="post-metadata">

**Author:** ![Pamela\_Davis](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/pamela_davis/32/1890_2.png) [@Pamela\_Davis](https://cl.desmos.com/u/Pamela_Davis)\
**Post date:** [May 5, 2021, 4:54pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/5 "2021-05-05T16:54:46Z")

</div>

Thank you, Daniel for such a quick response!!

I tried that (correct: Q15.script.correct) but I get an error message: Sink “correct” expects a boolean but got a string. I don’t know how to correct this.

It’s slide 10: [IB Differentiation Exam • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/609058239f233d42e95a58dd)

I haven’t fine tuned the other slides yet.

---

<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:** [May 5, 2021, 5:07pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/6 "2021-05-05T17:07:34Z")

</div>

Sorry, looks like you are probably intending to latex match equation and correct, so:

```auto
correct: Q15.script.equation=Q15.script.correct

```

---

<div class="post-metadata">

**Author:** ![Pamela\_Davis](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/pamela_davis/32/1890_2.png) [@Pamela\_Davis](https://cl.desmos.com/u/Pamela_Davis)\
**Post date:** [May 5, 2021, 5:48pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/7 "2021-05-05T17:48:55Z")

</div>

Ok, I guess I have a bigger problem. I think it is randomizing my answers rather than sinking my answers to the random questions. I’m not sure how to fix this.

---

<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:** [May 5, 2021, 5:50pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/8 "2021-05-05T17:50:58Z")

</div>

Wait sorry. Try this:

```auto
correct: this.latex=Q15.script.correct

```

---

<div class="post-metadata">

**Author:** ![Pamela\_Davis](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/pamela_davis/32/1890_2.png) [@Pamela\_Davis](https://cl.desmos.com/u/Pamela_Davis)\
**Post date:** [May 5, 2021, 6:03pm UTC](https://cl.desmos.com/t/correct-sink-using-random-generated-problems/3193/9 "2021-05-05T18:03:29Z")

</div>

YES! That worked!!

Thank you again!!!
