Loading

SecureRandom-随机数的生成

随机数:算法+种子

随机数据不随机

学习了:https://www.cnblogs.com/deng-cc/p/8064481.html

StringBuffer buffer = new StringBuffer();
int length=64;
char[] allChar = {'0','1','2','3','4',...,'a','b','c',...,'A','B','C'...};
SecureRandom random = new SecureRandom();
for(int i=0; i< length; i++){
    buffer.append(allChar[random.nextInt(allChar.length)]);
}

 

posted @ 2018-07-13 09:27  stono  阅读(256)  评论(0编辑  收藏  举报