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;