Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var totalQuestions = 10;
- var amountToPick = 5;
- var questionsList:Array = [];
- while(questionsList.length<amountToPick) {
- var randomNumber = random(totalQuestions)+1;
- var foundRepeat = false;
- for(var i in questionsList) {
- if(questionsList[i] == randomNumber) {
- foundRepeat = true;
- break;
- }
- }
- if(!foundRepeat) {
- questionsList.push(randomNumber);
- }
- }
- trace(questionsList);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement