From 9b8d0750475ad0a65682403d511cb3815203ffac Mon Sep 17 00:00:00 2001 From: paste <147841049+pastc@users.noreply.github.com> Date: Sat, 9 Mar 2024 07:30:24 +0900 Subject: [PATCH] Minor: Fix v2 --- README.md | 2 +- crash.go | 2 +- crash_test.go | 2 +- csv.go | 73 ------------------------------------------------ dice.go | 2 +- dice_test.go | 2 +- internal/math.go | 37 ------------------------ internal/util.go | 6 ---- plinko.go | 2 +- plinko_test.go | 2 +- roll.go | 2 +- roll_test.go | 2 +- 12 files changed, 9 insertions(+), 125 deletions(-) delete mode 100644 csv.go delete mode 100644 internal/math.go diff --git a/README.md b/README.md index cf0c2ac..a7d2acf 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ All the algorithms are provably fair. ## Install ```shell -go get github.com/pastc/vero +go get github.com/pastc/vero/v2 ``` ## Features diff --git a/crash.go b/crash.go index efd4a2f..8a85543 100644 --- a/crash.go +++ b/crash.go @@ -4,7 +4,7 @@ import ( "math" "strconv" - "github.com/pastc/vero/internal" + "github.com/pastc/vero/v2/internal" ) // houseEdge i.e, percentage that the house gets diff --git a/crash_test.go b/crash_test.go index 3771e97..a30cf49 100644 --- a/crash_test.go +++ b/crash_test.go @@ -4,7 +4,7 @@ import ( "strconv" "testing" - "github.com/pastc/vero/internal" + "github.com/pastc/vero/v2/internal" ) func TestCrash(t *testing.T) { diff --git a/csv.go b/csv.go deleted file mode 100644 index 255e0e9..0000000 --- a/csv.go +++ /dev/null @@ -1,73 +0,0 @@ -package vero - -//import ( -// "crypto/sha256" -// "encoding/csv" -// "fmt" -// "log" -// "os" -// "strconv" -//) -// -//type Has struct { -// ID int -// Hash string -//} -// -////func (h Hash) -// -//func read(q int) []Has { -// file, err := os.Open("hash.csv") -// if err != nil { -// log.Fatal(err) -// } -// defer func(file *os.File) { -// err = file.Close() -// if err != nil { -// log.Fatal(err) -// } -// }(file) -// content, err := csv.NewReader(file).ReadAll() -// if err != nil { -// log.Fatal(err) -// } -// -// var Hashes []Has -// -// for i := 0; i <= q && i < len(content); i++ { -// fmt.Println(content[len(content)-i-1][0]) -// } -// -// return Hashes -//} -// -//func generate(q int) { -// file, err := os.Create("hash.csv") -// if err != nil { -// log.Fatal(err) -// } -// defer func(file *os.File) { -// err = file.Close() -// if err != nil { -// log.Fatal(err) -// } -// }(file) -// writer := csv.NewWriter(file) -// defer writer.Flush() -// -// secret := hash("SECRET") -// for i := 1; i <= q; i++ { -// err = writer.Write([]string{secret, strconv.Itoa(i)}) -// if err != nil { -// log.Fatal(err) -// } -// secret = hash(secret) -// } -//} -// -//func hash(s string) string { -// h := sha256.New() -// h.Write([]byte(s)) -// bs := h.Sum(nil) -// return fmt.Sprintf("%x", bs) -//} diff --git a/dice.go b/dice.go index 19b5ae7..794299f 100644 --- a/dice.go +++ b/dice.go @@ -4,7 +4,7 @@ import ( "math" "strconv" - "github.com/pastc/vero/internal" + "github.com/pastc/vero/v2/internal" ) // Dice generates a random integer from 0 to 9999 diff --git a/dice_test.go b/dice_test.go index 8d6f8f2..3833c93 100644 --- a/dice_test.go +++ b/dice_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/pastc/vero/internal" + "github.com/pastc/vero/v2/internal" ) func TestDice(t *testing.T) { diff --git a/internal/math.go b/internal/math.go deleted file mode 100644 index e92b44c..0000000 --- a/internal/math.go +++ /dev/null @@ -1,37 +0,0 @@ -package internal - -//func Factorial(n int) int { -// if n == 0 || n == 1 { -// return 1 -// } -// -// return n * Factorial(n-1) -//} - -////Binomial -//// -////n = Row number -//// -////r = Column number -//func Binomial(n, r int) int { -// if n < 0 || r < 0 { -// return 0 -// } -// if n < r { -// return 0 -// } -// // (n,k) = (n, n-k) -// if r > n/2 { -// r = n - r -// } -// b := 1 -// for i := 1; i <= r; i++ { -// b = (n - r + i) * b / i -// } -// return b -//} - -//// BinomialDistribution calculates the binomial distribution probability. -//func BinomialDistribution(n, r int) float64 { -// return float64(Binomial(n, r)) * math.Pow(0.5, float64(n)) * 100 -//} diff --git a/internal/util.go b/internal/util.go index 1d208b9..00b5068 100644 --- a/internal/util.go +++ b/internal/util.go @@ -52,12 +52,6 @@ func Hash256(s string) string { return string(h.Sum(nil)) } -//func Hash512(s string) string { -// h := sha512.New() -// h.Write([]byte(s)) -// return string(h.Sum(nil)) -//} - func Hmac256(key string, s string) string { hmacHash := hmac.New(sha256.New, []byte(key)) hmacHash.Write([]byte(s)) diff --git a/plinko.go b/plinko.go index 04865f0..fb62307 100644 --- a/plinko.go +++ b/plinko.go @@ -4,7 +4,7 @@ import ( "math" "strconv" - "github.com/pastc/vero/internal" + "github.com/pastc/vero/v2/internal" ) // Plinko generates the column number that the ball landed on diff --git a/plinko_test.go b/plinko_test.go index 3e671c8..52be933 100644 --- a/plinko_test.go +++ b/plinko_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/pastc/vero/internal" + "github.com/pastc/vero/v2/internal" ) func TestPlinko(t *testing.T) { diff --git a/roll.go b/roll.go index d220c74..f8a84b5 100644 --- a/roll.go +++ b/roll.go @@ -3,7 +3,7 @@ package vero import ( "strconv" - "github.com/pastc/vero/internal" + "github.com/pastc/vero/v2/internal" ) // maximum is the maximum value that can be rolled, counting from 0 diff --git a/roll_test.go b/roll_test.go index 7f6b0f8..efac6c1 100644 --- a/roll_test.go +++ b/roll_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/pastc/vero/internal" + "github.com/pastc/vero/v2/internal" ) func TestRoll(t *testing.T) {