From d69b3e8ea979ca748dfddc0d9377db60bac9a1df Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Sun, 17 Nov 2024 18:12:23 +0300 Subject: [PATCH] WIP -> main post-merge editing --- src/corrupter.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/corrupter.c b/src/corrupter.c index da146a4..6511fa0 100644 --- a/src/corrupter.c +++ b/src/corrupter.c @@ -9,26 +9,6 @@ static bool is_line_ending(byte c); /* function implementations */ static bool get_chance(uint16_t desired_chance) { -/* TODO: remove this multi-line comment before merging into main branch -// algorithm v1 - // calculate the cumulative distribution function (CDF) - uint8_t cdf[UINT8_MAX_PLUS_1]; - memset(cdf, 0, sizeof(cdf)); - for (uint8_t i = 0; i < UINT8_MAX; i++) - cdf[i] = cdf[i] + ((i - 1) <= desired_chance); - - // generate a random number in the range of 0 to the total weight - uint8_t random_number = mt_next() & UINT8_MAX; - - // use the CDF to determine the outcome - for (uint8_t i = 0; i < UINT8_MAX; i++) - if (random_number < cdf[i]) - return true; - return (random_number < cdf[UINT8_MAX] || - random_number < cdf[UINT8_MAX_PLUS_1]); -*/ - -// algorithm v2 if (desired_chance == UINT16_MAX) return true;