• 自动生成不重复的含有数字和字母的随机码


    /**
    * 随机代码生成,长度不超过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);
                    }
            }
    }
  • 相关阅读:
    dp学习笔记1
    hdu 4474
    hdu 1158(很好的一道dp题)
    dp学习笔记3
    dp学习笔记2
    hdu 4520+hdu 4522+hdu 4524(3月24号Tencent)
    hdu 1025(最长非递减子序列的n*log(n)求法)
    hdu 2063+hdu 1083(最大匹配数)
    hdu 1023
    《 Elementary Methods in Number Theory 》Exercise 1.3.12
  • 原文地址:https://www.cnblogs.com/wuhuisheng/p/2007691.html
Copyright © 2020-2023  润新知