我觉得,你已经用到了数据库,为什么不设置一个字段呢,将答对的打上标记,只取没有标记的3道题目。我觉得把信息存在session中不好。

解决方案 »

  1.   

    感觉存在session还行,比较方便调用。
      

  2.   

    一个算法的实现而已
    关键在于随机不重复:
    取个例子:
    对字符串的随机排列import java.util.*;
    public class NoReRandom
    {
    public static void main(String[] args)
    {
        NoReRandom a=new NoReRandom();
        String after=a.order("abcdefghijk");
        System.out.println(after);
    }
    public String order(String str)
    {
    char[] ch=str.toCharArray();
    boolean[] check=new boolean[ch.length];
    StringBuffer newOrder=new StringBuffer();for(int i=0;i<ch.length;i++)
    {
    int temp=(int)(Math.random()*ch.length);
    while(check[temp])
    {
    temp=(int)(Math.random()*ch.length);
    }
    check[temp]=true;
    newOrder.append(ch[temp]);
    }
    return newOrder.toString();
    }}