| 16 | } |
| 17 | |
| 18 | void chaos_game(struct point *in, size_t in_n, struct point *out, |
| 19 | size_t out_n) { |
| 20 | |
| 21 | struct point cur_point = {drand(), drand()}; |
| 22 | |
| 23 | for (size_t i = 0; i < out_n; ++i) { |
| 24 | out[i] = cur_point; |
| 25 | struct point tmp = random_element(in, in_n); |
| 26 | cur_point.x = 0.5 * (cur_point.x + tmp.x); |
| 27 | cur_point.y = 0.5 * (cur_point.y + tmp.y); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | int main() { |
| 32 | const size_t point_count = 10000; |
no test coverage detected