From a82bbfaec07fe9b69d8fbebf65abd86642fc1fb1 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Wed, 27 May 2020 22:48:52 +0200 Subject: [PATCH] ex-3: revert testing change left by someone --- ex-3/main.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ex-3/main.c b/ex-3/main.c index d5312ef..df87931 100644 --- a/ex-3/main.c +++ b/ex-3/main.c @@ -85,16 +85,12 @@ int main(int argc, char **argv) { fputs("# event sampling\n\n", stderr); fprintf(stderr, "generating %ld events...", opts.num_events); struct event *e; -// for (size_t i = 0; i < s.size; i++){ -// e = &s.events[i]; -// do { -// e->th = acos(1 - 2*gsl_rng_uniform(r)); -// e->ph = 2 * M_PI * gsl_rng_uniform(r); -// } while(0.2 * gsl_rng_uniform(r) > distr(def_par, e)); for (size_t i = 0; i < s.size; i++){ e = &s.events[i]; - e->th = acos(1 - 2*gsl_rng_uniform(r)); - e->ph = 2 * M_PI * gsl_rng_uniform(r); + do { + e->th = acos(1 - 2*gsl_rng_uniform(r)); + e->ph = 2 * M_PI * gsl_rng_uniform(r); + } while(0.2 * gsl_rng_uniform(r) > distr(def_par, e)); // update the histogram gsl_histogram2d_increment(hist, e->th, e->ph);