标签:static test rac turn sys 技术 stat one 十六
1 public class TestRandom { 2 public static void main(String[] args) { 3 System.out.println(getRandomCharacter(‘0‘, ‘9‘)); 4 System.out.println(getRandomCharacter(‘a‘, ‘z‘)); 5 System.out.println(getRandomCharacter(‘A‘, ‘Z‘)); 6 System.out.println(getRandomCharacter(‘\u0000‘, ‘\uFFFF‘)); 7 } 8 9 /** 10 * 每一个字符都有唯一的统一码;在0到十六进制FFFF(即十进制65535)之间。 11 * */ 12 public static char getRandomCharacter(char ch1, char ch2) { 13 return (char)(ch1 + Math.random() * (ch2 - ch1 + 1)); 14 } 15 }
标签:static test rac turn sys 技术 stat one 十六
原文地址:http://www.cnblogs.com/AlbertZhe/p/7851413.html