概率相等红包
parent
3742a2aa74
commit
13fb52cd3a
|
@ -42,7 +42,10 @@ public class HongBaoAlgorithm {
|
||||||
* @param max
|
* @param max
|
||||||
* @return
|
* @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)));
|
return sqrt(nextLong(sqr(max - min)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue