首页 > 技术文章 > 去LIST里面随机值

cuijinlong 2017-06-08 15:26 原文

   List<Integer> listUser = bqManagerMapper.getBqManagerList();
   int userid = listUser.get(getRandomInt(listUser.size()));

  

 public static int getRandomInt(int max) {   return getRandom().nextInt(max);  }

 public static ThreadLocalRandom getRandom() {   return ThreadLocalRandom.current();

 }

推荐阅读