Here is the reference implementation and I do not understand why choose 21 here? Thanks.
public static int rand7() {
    while (true) {
        int num = 5 * (rand5() - 1) + (rand5() - 1);
        if (num < 21) return (num % 7 + 1);
    }
}
BTW, I read that question before asking, my specific question is why using 21 here. In that thread, it is not answered. If I missed anything, please feel free to correct. Thanks. :) thanks in advance, Lin
 
     
    