Get a small skill from the random number
Forgot this skill where I saw it. The original question is: How to calculate 2 × 2 × 2 = 8 speed is the fastest. Answer: 2 <<< 2. Because the shift speed is the fastest.
Although the number of random numbers do not necessarily require speed, this is not a good way.
The following statement gets the random number of 1-> 8.
INT TMP = () >>> 1)% 8 1; // 1-> 8 random number or int TMP = math.abs (Rand.NextINT ())% 8 1; // 1 -> 8 random number
Also note that 0 <= (Rand.NextINT () >>> 1)% 8 <= 7, so it is to be added to the rear.