()
| 144 | } |
| 145 | |
| 146 | static Task randCreateTask() { |
| 147 | var rand = Random.getInstance().nextInt(TotalWeight); |
| 148 | for (var task : taskFactorys) { |
| 149 | if (rand < task.Weight) |
| 150 | return task.Factory.get(); |
| 151 | rand -= task.Weight; |
| 152 | } |
| 153 | throw new RuntimeException("impossible!"); |
| 154 | } |
| 155 | |
| 156 | static void prepare() throws Exception { |
| 157 | for (var tf : taskFactorys) |
no test coverage detected