How do you randomize a list?

So I'm new here in the mit app inventor it is from our school our professor want us to randomize the list in our app but i'm having a hard time using all of the blocks since our professor didn't teach us on how to use this mit app.

So what I want to do is randomize the logolist but i want them show all the 30 items in random before it show the last page.



Taifun


It works on randomizing the logoList now the problem is how do I sync the answerList and answerChoices

here is the block of my submitBtn

And also it randomize the logoList but the answerQuestion its not syncing with the logoList

How do I sync the list that I make I want to synch the answerChoices and answerList to logoList since the logoList is randomized

Here is my aia
GUESSTHELOGO00 (1).aia (3.6 MB)

Could you please explain what you want to do in greater detail (I don't exactly understand what "syncing" means, in this context)?

since the logoList is randomized the 2 variables answerChoices and questionNumber is not syncing with logoList that 2 variables which is answerChoices and questionNumber starts with index 1 and I want it to be same with the logoList for example if the logoList select index 4 I want the answerChoices and questionNumber select index 4 aswell.

I think I've understood.
You could try combining all the variables into nested lists or a dictionary, so you don't have to worry about "syncing" them.

can you help me with the blocks? I'm new in MIT and still having a hard time

add this to the QuizScreen.Initialize event:


Now, in the sublists of the answerChoices list, the 4th index will be the answer, and the 5th index will be the logo. You can adjust your code accordingly (though, there is a lot of adjusting to be done).

You may also change the name of the list if it confuses you.

I already match the answerChoices to the logoList, However the last problem that I have now is that the answerList that is not matching with the logoList it gives me wrong answer. Is there any way to pass the value of index in submitBtn?


1 Like

Make index a global variable.

blocks (6)

Here is an example of how to access related data in a list of lists, when one item is extracted and randomly selected:

(relies on unique values in index 1, otherwise the first occurrence will always be selected)

1 Like

one way (easy but may cost some time) is to merge two list into one.

or Do not shuffle the question and answer list, but shuffle the index list:

  1. make a list of number 1, 2, 3, to length of question list.
  2. shuffle this index list.
  3. get list item one by one, and with this index, get the relavent question and answer.
1 Like


Using this block it matches the question and answer but after pressing the nextBtn it shuffles again.

here is my nextBtn
2

demo for my suggestion at post 15#

1 Like

GUESSTHELOGO00 (2).aia (3.6 MB)
Can you try it with my aia? Im having a hard time trying to understands those blocks. I dont know exactly what blocks i need to replace

just replace the questions and anwsers list with your data.

1
2
Can you check this one? I'm getting a lot of errors

what's the error? please always make your question clear / completed and easy to understand for others.