# Square root of a randomly generated number?

I have code to have students click a button to randomly generate a number that represents a sample size.
Students then use this sample size in their calculation.
My goal is to have a table with a check mark if the student calculation is correct.
Problem - I can’t figure out the code to to take the square root of the randomly generated value.
I’m very new to CL coding so the simpler the answer the better.
Thanks for any help.

Something like this?

r = randomGenerator(NewNumber.pressCount)

number = r.int(1,100)

squareRoot = simpleFunction("\operatorname{sqrt}(x)","x")

numbersRoot = squareRoot.evaluateAt(number)


You could also combine the last two (I think your x needs to be in curly braces as well):

squareRoot  = simpleFunction(\sqrt{\${number}}).evaluateAt(0)


Additionally, simpleFunctions only need to have the latter variable parameter if it is not x or if there is more than one variable. If it’s not there, it defaults to in terms of x.

1 Like