package types import ( "math/big" "github.com/minio/blake2b-simd" ) type Ticket struct { VRFProof []byte } func (t *Ticket) Quality() float64 { ticketHash := blake2b.Sum256(t.VRFProof) ticketNum := BigFromBytes(ticketHash[:]).Int ticketDenu := big.NewInt(1) ticketDenu.Lsh(ticketDenu, 256) tv, _ := new(big.Rat).SetFrac(ticketNum, ticketDenu).Float64() tq := 1 - tv return tq }