C# Random Question Picker(to be combine with unity) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C# Random Question Picker(to be combine with unity)

How to create a random picker of question using C#? The questions is done but not assign with id. For example I have 10questions, but I only want to choose 5 questions to generate paper for every quiz.

20th Jun 2018, 2:30 PM
CHONG SOONG YANG
CHONG SOONG YANG - avatar
3 Answers
+ 1
Unity.Random class may help.
20th Jun 2018, 3:36 PM
Rusty.Metal
0
you can encode all that info in an array questions = List<int>(1,0,0,1,1,0,0,0,1,1); // I may ve wrong with syntax that means to get questions #1,4,5,9,10 to the quiz. Now you should generate randomly a list with that form.
20th Jun 2018, 3:20 PM
Bebida Roja
Bebida Roja - avatar
0
Put the questions into a string array and then select a random number, using the random class, based on the questions' index position.
20th Jun 2018, 3:56 PM
Bagshot
Bagshot - avatar