/**
* 随机代码生成,长度不超过36
* 自动生成不重复的含有数字和字母的随机码
*/
package src;

import java.util.ArrayList;

public class Test {

        public static void main(String[] args) throws IndexOutOfBoundsException {
                ArrayList list = new ArrayList();
                // list.add(1);
                for (int i = 0; i < 10; i++)
                        list.add(i);

                for (char c = 'a'; c <= 'z'; c++)
                        list.add(c);
                /*for (int i = 0; i < list.size(); i++) {
                        System.out.println(list.get(i));
                }*/
                for (int i = 0; i < Math.random()*36+1; i++) {
                        int mathInt;
                        mathInt=(int) (Math.random()*list.size());
                        System.out.print(list.get(mathInt));
                        list.remove(mathInt);
                }
        }
}

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-10-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-02-18
  • 2022-01-06
  • 2021-06-26
  • 2022-01-24
相关资源
相似解决方案