Android random activites without repetition

后端 未结 2 1684
谎友^
谎友^ 2021-01-28 04:08

I am developing a quiz game, where I have to get random activities on answering the questions as to avoid the questions in same order. I have fixed this by using switch

2条回答
  •  故里飘歌
    2021-01-28 05:14

    use

    ArrayList number = new ArrayList();
    for (int i = 1; i <= 10; ++i) number.add(i);
    Collections.shuffle(number);
    

提交回复
热议问题