How to Limit the Generation of Random Data?

marcway shared this question 3 years ago

Hello, everyone,

I'd like to ask for another help with this other problem:

1- Attached is a construction that has 2 indices:

1.1 idx = AleatoryNumber(1,8) - choose a regular polygon from the list1

1.2 idy = AleatoryNumber(1,2) - choose a question, from 2 drop-down lists

2- I would like random data generation to be limited. I'll explain:

Every time the question or file is opened there is random data generation.

So when the Applet is loaded in Moodle and the student opens it to answer, the random generation draws a regular polygon and a question for him.

After the question is answered if I click on it new random data is generated and I don't know which polygon and initial question were drawn for the student.

Is there any way to limit this random data generation?

Thank you very much, Marcelo.

Comments (5)


For me is not really clear what you want reaching.

But maybe the attachment will help.

It contains only the principle for the following request:

At the beginning and with each new question the student receives a random selection of the questions, which is repeated after 8 new questions at the earliest. The generation of the random values is inside of scripts, so that UpdateConstruction() / Ctrl+R / F9 have no influence. The most important command used is Shuffle() in the button "Reset".


Dear Rami and Michael,

Thank you very much for the precious help. You always help me!

Rami, thank you very much for the construction so well done that you sent me. Worked perfectly!

I will explain the problem that has not yet been solved in steps:

1- I make a construction that provides regular polygons and questions to students, at random, using the command RandomBetween () through the indices "idx" and "idy"

2- I send the construction to the Moodle environment as a type of question.

3- The student accesses the question in the Moodle environment and answers it. Everything works well so far. Consider that the polygon presented to the student by Geogebra was a square.

4- When I click on the question answered by the student, to correct it, in Moodle, Geogebra provides another polygon for me, different from the square provided for the student.

4.1- This is because RandomBetween () remains active

5- Although the student's responses are recorded, the polygon I am seeing is different from the polygon the student saw.

6- Is it possible to create some type of counter, which limits the number of times RandomBetween () works?

7- It should work until the student responds. When I clicked on the question, it should provide me with exactly what the student received, without RandomBetween () working to provide another polygon.

Sorry for the space taken to write the problem.

Thank you very much, Marcelo.


Maybe this command is also interesting:

RandomBetween( <Minimum Integer>, <Maximum Integer>, <Boolean Fixed> )


Unfortunately, I don't know anything about Moodle.

But anyway: the step to a new task should not be done with Strg-R or F9, but the new random values must be set in a script (This requires that idx and idy are free objects)

Someone (student, teacher or Moodle) must trigger this script.


Hi Rami, 
Thank you very much for another precious help! Thank you very much for always helping us with your knowledge. 
I understand what you explained and it is an excellent alternative. 
One of my professors, Professor Humberto Bortolossi, who has several wonderful constructions posted on GeogebraTube, explained to me that there is an incompatibility between the Geogebra 1.92 q-type plugin with Moodle. 
So, I uninstalled the new version 1.92 plugin and installed the old Geogebra q-type plugin version 1.05 and it worked! 
Thank you! Marcelo.

© 2023 International GeoGebra Institute