random selection from array
<p>I have this block of code below which is to control questions which are to be displayed from the array.
I am having problem with the the 3rd line of code, an i am not entirely sure what the problem is.</p>

<p>rnd1, rnd2 are both double. Eclipse is telling me that rnd2 should be an int. however i was advised that the rnd's should be double for the ceiling function to work.
ques is a text field. questions is the array.</p>

<pre><code> rnd1 = Math.ceil(Math.random()*3);
 rnd2 = Math.ceil(Math.random()*questions.length)-1;
 ques.setText(questions[rnd2]);
</code></pre>

<hr>

<p>Im basing this on action script which i used for a quiz application.
It is used to pick out the question from the question array randomly.</p>

<pre><code>rnd1=Math.ceil(Math.random()*3);
rnd2=Math.ceil(Math.random()*questions.length)-1;
q.text=questions[rnd2];
if(questions[rnd2]=="x")
{
  change_question();
}
questions[rnd2]="x";
enable_disable(1);
</code></pre>
