Random List of Questions

I have stepped away from Thunkable for awhile now due to life and covid but I have returned to continue my education here. A lot has changed since I have last been here and I still have tons to learn. I have the beginnings of a quiz app and need some guidance from the community.

My question is how do I create a list of randomly selected question from my local db? I have a local db with 8 questions currently and would like to say pick a random 4 questions for each quiz. I have read through a bunch of past post but still cant get my head wrapped around how to make it work.

What I think I may need is for someone to actually show me in my app block so I can see it in action and understand how it is accomplishing the function. I learn a little better for a “monkey see monkey do” method.

I have added the link to a copy of my project below if anyone is will to assist. The page with the blocks in need is in “Category 1 - General”.

https://x.thunkable.com/projects/616e3d9662131c0010ef11ba/734a6ce6-9cf6-4e76-a4b9-d410725c921e/designer

I am open to all advice and thanks in advance.

1 Like

I will use something like this

I added a variable to hold the list of random 3 questions out of the available questions. I created a list of 1 to the number of rows in the table and shuffled the list and then selected the fist 3.

This has now become my randomly selected questions.

In the Update quiz screen question function, I assign the first number in the list to the variable question and immediately remove it from the list to avoid duplicates.
image

You will need to check that the list of selected questions is not empty before attempting to read the next question.

Have Fun Thunking!

2 Likes

@muneer this is a really elegant solution! :clap:

2 Likes

Many thanks @tatiang