Commit Graph

10 Commits

Author SHA1 Message Date
Aayush Rajasekaran
ff0fa3471f
chore: refactor: drop unused IsTicketWinner (#10801) 2023-05-02 11:22:02 -07:00
Łukasz Magiera
e65fae28de chore: fix imports 2022-06-14 17:00:51 +02:00
Jakub Sztandera
4895c895aa
Change WinCount to int64, wire it to BlockMessage
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-24 19:51:22 +02:00
Jakub Sztandera
2b597fb780
Add tests for lambda
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-23 16:24:02 +02:00
Jakub Sztandera
d7f710806b
Implement golden tests for Poisson distribution
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-23 16:24:02 +02:00
Jakub Sztandera
d92362f96e
Add comments about algorithm
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-23 16:24:02 +02:00
Jakub Sztandera
8fea872345
Refactor poisson to struct for easier testing
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-23 16:24:02 +02:00
Jakub Sztandera
84c0b50aa1
Rename fxToD
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-23 16:24:01 +02:00
Jakub Sztandera
f523b17a35
Improve performance of ComputeWinCount
As it turns out `big.Int#Mul` doesn't like it when you reuse input as
output.

```
name         old time/op    new time/op    delta
WinCounts-8    4.56µs ± 1%    3.90µs ± 2%  -14.44%  (p=0.000 n=9+10)

name         old alloc/op   new alloc/op   delta
WinCounts-8    3.50kB ± 0%    1.15kB ± 0%  -67.23%  (p=0.000 n=10+10)

name         old allocs/op  new allocs/op  delta
WinCounts-8      45.0 ± 0%      24.0 ± 0%  -46.67%  (p=0.000 n=10+10)
```

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-23 16:24:01 +02:00
Jakub Sztandera
ee5639aad9
Initial implementation of Poisson Sortition
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-06-23 16:24:01 +02:00