Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: simplify
random_fe_non_zero
(remove loop limit and unneeded …
…normalize) `random_fe_non_zero` contains a loop iteration limit that ensures that we abort if `random_fe` ever yielded zero more than ten times in a row. This construct was first introduced in PR bitcoin#19 (commit 09ca4f3) for random non-square field elements and was later refactored into the non-zero helper in PR bitcoin#25 (commit 6d6102f). The copy-over to the exhaustive tests happened recently in PR bitcoin#1118 (commit 0f86420). This case seems to be practically irrelevant and I'd argue for keeping things simple and removing it; if there's really a worry that the test's random generator is heavily biased towards certain values or value ranges then there should consequently be checks at other places too (e.g. directly in `random_fe` for 256-bit values that repeatedly overflow, i.e. >= p). Also, the _fe_normalize call is not needed and can be removed, as the result of `random_fe` is already normalized.
- Loading branch information