… | |
… | |
265 | |
265 | |
266 | // uniform distribution |
266 | // uniform distribution |
267 | uint32_t operator ()(uint32_t r_max) |
267 | uint32_t operator ()(uint32_t r_max) |
268 | { |
268 | { |
269 | return is_constant (r_max) |
269 | return is_constant (r_max) |
270 | ? this->next () % r_max |
270 | ? (next () * (uint64_t)r_max) >> 32U |
271 | : get_range (r_max); |
271 | : get_range (r_max); |
272 | } |
272 | } |
273 | |
273 | |
274 | // return a number within (min .. max) |
274 | // return a number within (min .. max) |
275 | int operator () (int r_min, int r_max) |
275 | int operator () (int r_min, int r_max) |
276 | { |
276 | { |
277 | return is_constant (r_min) && is_constant (r_max) |
277 | return is_constant (r_min) && is_constant (r_max) |
278 | ? r_min + (*this) (max (r_max - r_min + 1, 1)) |
278 | ? r_min + operator ()(max (r_max - r_min + 1, 1)) |
279 | : get_range (r_min, r_max); |
279 | : get_range (r_min, r_max); |
280 | } |
280 | } |
281 | |
281 | |
282 | double operator ()() |
282 | double operator ()() |
283 | { |
283 | { |