概率相等红包

back_recharge
mengchengzhen 2021-06-01 10:08:37 +08:00
parent 3742a2aa74
commit 13fb52cd3a
1 changed files with 4 additions and 1 deletions

View File

@ -42,7 +42,10 @@ public class HongBaoAlgorithm {
* @param max
* @return
*/
static long xRandom(long min, long max) {
static long xRandom(long min, long max) {
if(min == max){
return 0;
}
return sqrt(nextLong(sqr(max - min)));
}