0
I am making a quiz system, where the correct answer will always be the first alternative in the database, but it is necessary that it be random when it comes to answering. (PHP)
It is possible to randomize the data within alternatives
?
"questions": [{
"title": "Qual é a raça de Goku?",
"image": {
"path": ""
},
"alternatives": [{
"title": "Sayajins",
"image": {
"path": ""
},
"correct": true
}, {
"title": "Anjo",
"image": {
"path": ""
}
}, {
"title": "Android",
"image": {
"path": ""
}
}],
"alternativeType": 1
}
This code you sent is in Javascript! No ?
– Rafael Laurindo
@Rafaellaurindo not, it is being encoded as json
– Gabriel
Possible duplicate of How to take data from an array and use Rand without repeating?
– Woss