case i when 1..25 then 1 when 26..50 then 2 when 51..60 then 3 when 61..70 then 4 when 71..80 then 5 when 81..90 then 6 when 91..100 then 7
whywhy36
2014-11-03 11:05:08 +08:00
sorry, no Chinese Input Method :-(
1. init one mapping according to the probability 1-25 -> 0 26-50 -> 1 51-60 -> 2 ... 2. Random.nextInt(100) 3. pick the index from the mapping 4. get the number ...