我正在尝试理解此代码,特别是文字在这里的工作方式,该代码正确地从a-z生成随机字母,但是我可以对导致该工作的原因进行解释,特别是声明(int)'a';
private static final int RANDOM_SET_SIZE = 3;
private static final int A_LETTER_CODE_POINT = (int) 'a';
private static final int LETTER_BOUND = (int) 'z' - A_LETTER_CODE_POINT + 1;
private static final Random random = new Random(currentTimeMillis());
private static char randomLetter() {
return (char) (A_LETTER_CODE_POINT + random.nextInt(LETTER_BOUND));
}