# Q: Can a polygraph include random numbers?

Dear Desmos folks,

I am experimenting with trying to make a polygraph paired-question-asking game which doesn’t use exactly the same elements every time.

Obviously this would need to be done with care, as the 16 tiles all need to remain distinct. The potential advantage would be to keep things fresh for the students, even if they play the game several times in a row.

I tried incorporating a random number generator into the graph for one of the tiles, but something strange happens.

When I put, for example:
a = [1…10].random
into a graph that makes one of the polygraph tiles, the result always seems to be the final number in the list. In other words, the random command doesn’t complain with an error, but it does appear to stop being random!

I thought I might be able to get around this by generating a random number in the CL, but polygraph doesn’t have any CL commands available at present.

There is already an element of randomness in that the tiles get shuffled for the question-asker. Is it possible also to shuffle them for the question-answerer? Anything that helps to vary one game from the next would be welcome.

Many thanks,

Raj

Whether a polygraph or other activity, random in a graph will return the same values. Random in CL, however, will give unique values. So when the aim is different values each time (or for each student), you can use a random in the CL, or a random seed set in the CL to be used in the random value. I don’t that there is CL capability in polygraph though.

Aha, that’s useful to know, thanks.

I hadn’t realised that a normal graph always gives the same initial random value, because I had been calling the random function via a user-click action. Each action-produced randmom-call does seem to produce a new value.

Interesting, can you post an example? Just for my own personal knowledge.Thanks!

Here’s an example: a logarithms game. The movement of the squirrel bouncing around involves repeatedly calling random(), via the ticker. Also, shuffle gets applied to lists to create random orderings:

Being called by the ticker must be doing it. I will note that the initial problem is always log14.

Good point about the initial random call.

Out of interest, I’d be curious to hear what you think of the game, r if you have any comments or suggestions!

Raj

It’s a fun idea. I had some difficulty when there was a short log I wanted to remove. It seems to be behind the grass image (set it to “Place behind graphs” in the long click menu), and can’t grab it. I understand it’s the target value, but the purple line just kind of bothers me visually. Maybe lower the opacity and/or make it a dotted line if you want to keep it. I think I’d get rid of the grid background as well, maybe a wall background or something instead if it looks too empty for you.

Thanks, those are excellent suggestions!