# Randomizing Answers in a Quiz

**URL:** <https://forum.kirupa.com/t/randomizing-answers-in-a-quiz/179834>\
**Category:** Uncategorized\
**Created:** [February 23, 2006, 9:20am UTC](https://forum.kirupa.com/t/randomizing-answers-in-a-quiz/179834 "2006-02-23T09:20:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kanna77](https://avatars.discourse-cdn.com/v4/letter/k/e68b1a/32.png) [@kanna77](https://forum.kirupa.com/u/kanna77)\
**Post date:** [February 23, 2006, 9:20am UTC](https://forum.kirupa.com/t/randomizing-answers-in-a-quiz/179834/1 "2006-02-23T09:20:31Z")

</div>

hi guys …

i m currently working on your quiz that is posted on  
[http://www.sephiroth.it/file\_detail.php?id=54](http://www.sephiroth.it/file_detail.php?id=54)

there is just 1 question, how do u change the answers from switching  
places? … i mean right now i have them all in … a,b,c and d but it  
is coming out randomly … how do i get it to display in order … ?  
no random display of answers. but the questions coming out in random is just fine.

thanx in advance guys…

the code actually goes like this :

// Building random answers  
function creaNuovoArray(){  
delete tempRis;  
tempRis = new Array();  
}

Object.prototype.nextRisposta = function(){  
ranAns = random(domande[ranQuestion][2].length)  
for(var i = 0; i \< domande[ranQuestion][2].length; i++){  
if(ranAns == tempRis\*){  
var prosegui = false;  
nextRisposta();  
break;  
}  
var prosegui = true;  
}  
if(prosegui){  
tempRis.push(ranAns);  
return ranAns;  
}  
}
