GetVertifyCode.java 938 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <<<<<<< HEAD
  2. package com.template.common.utils;
  3. import java.util.Random;
  4. public class GetVertifyCode {
  5. public static String getRandomNumCode(int number){
  6. String codeNum = "";
  7. int [] numbers = {0,1,2,3,4,5,6,7,8,9};
  8. Random random = new Random();
  9. for (int i = 0; i < number; i++) {
  10. int next = random.nextInt(10000);
  11. codeNum+=numbers[next%10];
  12. }
  13. return codeNum;
  14. }
  15. }
  16. =======
  17. package com.template.common.utils;
  18. import java.util.Random;
  19. public class GetVertifyCode {
  20. public static String getRandomNumCode(int number){
  21. String codeNum = "";
  22. int [] numbers = {0,1,2,3,4,5,6,7,8,9};
  23. Random random = new Random();
  24. for (int i = 0; i < number; i++) {
  25. int next = random.nextInt(10000);
  26. codeNum+=numbers[next%10];
  27. }
  28. return codeNum;
  29. }
  30. }
  31. >>>>>>> 7af63d5b21d6f0f53dd52bea2fab86f52d94f5ff