Skip to content

docs: document distribution properties of sample() and sample_in_range()#6

Open
jiayaoqijia wants to merge 1 commit intoleanEthereum:mainfrom
jiayaoqijia:fix/sample-distribution-docs
Open

docs: document distribution properties of sample() and sample_in_range()#6
jiayaoqijia wants to merge 1 commit intoleanEthereum:mainfrom
jiayaoqijia:fix/sample-distribution-docs

Conversation

@jiayaoqijia
Copy link
Copy Markdown

Fixes #4.

Documents the distribution properties of the two sampling methods in DuplexChallenger:

  • sample(): Documents that outputs are uniform in [0, P) (the full field), not [0, 2^31). No bias exists for field challenges.
  • sample_in_range(): Replaces the vague "Warning: not perfectly uniform" with concrete bias analysis. For the KoalaBear field, masking is perfectly uniform for bits ≤ 24 and has negligible bias (< 1/2) for bits 25-30. The bits = 31 case is excluded by assertion. In WHIR usage, bits is typically ≤ 20 (post-folding domain size), so bias is non-existent in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sample_bits() introduces 1/128 per-element bias for KoalaBear field

1 participant