Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Is it possible to randomize two lists identically?
- JMCJEDI2
-
Scratcher
5 posts
Is it possible to randomize two lists identically?
I am making a quiz game and I have two separate lists that the game checks, one for answers and one for questions. Is is possible to script in a code that randomizes them both the same to make the questions and answers still correspond to one another; eg question 10 is still hooked up with answer 10?
- vaibhavrau
-
Scratcher
100+ posts
Is it possible to randomize two lists identically?
im working on that!for me so far no
- RainaERusch
-
Scratcher
100+ posts
Is it possible to randomize two lists identically?
Maybe randomize the questions, then store the question number in a variable. Use that variable to find the answer in another list.
(item (# v) of [list v] :: list)
- crisostimo
-
Scratcher
500+ posts
Is it possible to randomize two lists identically?
This is very, very possible.
Please take a look at my well commented tutorial on how to randomize a list:
https://scratch.mit.edu/projects/93892570/#editor
All you need to do in order to randomize two lists in the same way is to add a second variable like ‘Temporary Data Holder 2’ and repeat all the items in the ‘if … then …’ statement in ‘Mix The List’ using the second list and your new variable.
Please take a look at my well commented tutorial on how to randomize a list:
https://scratch.mit.edu/projects/93892570/#editor
All you need to do in order to randomize two lists in the same way is to add a second variable like ‘Temporary Data Holder 2’ and repeat all the items in the ‘if … then …’ statement in ‘Mix The List’ using the second list and your new variable.
- deck26
-
Scratcher
1000+ posts
Is it possible to randomize two lists identically?
An alternative is to have a separate list containing the values 1 to N and you randomise that. Then you use the items in that list as the item numbers for the answers and questions.
ask (item (item (1 v) of [numbers v] :: list) of [questions v] :: list) and wait // for the first questionif item 1 of numbers is 5 then question 5 will be asked first.
- Studio42
-
Scratcher
500+ posts
Is it possible to randomize two lists identically?
Yep, what deck26 said is probably easiest
- JMCJEDI2
-
Scratcher
5 posts
Is it possible to randomize two lists identically?
Much appreciated, thanks a lot!
- Discussion Forums
- » Help with Scripts
-
» Is it possible to randomize two lists identically?