chainlink icon indicating copy to clipboard operation
chainlink copied to clipboard

Update ethschnorr_test.go

Open vibs29 opened this issue 3 years ago • 1 comments

fix an instance of one of the two(?) hardest problems in computer science https://pkg.go.dev/crypto/rand#Int

vibs29 avatar Jun 09 '22 06:06 vibs29

I presume this hasn't been merged because my message was inadequate in the same way that Go's documentation above was inadequate.

Integers in [3,6] are the set {3,4,5,6} Integers in (3,6) are the set {4,5} Integers in (3,6] are the set {4,5,6} Integers in [3,6) are the set {3,4,5}

That is, square brackets mean something different from round ones.

Go's documentation above says, "Int returns a uniform random value in [0, max)" The round bracket at the end means Int never returns max itself. Thus the original ethschnorr_test.go code specifies an upper bound that is (harmlessly) one integer too small and my patch improves it by fixing its off-by-one error.

vibs29 avatar Sep 20 '22 18:09 vibs29

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 25 '22 00:11 github-actions[bot]