fix coin flip

This commit is contained in:
Your Name 2023-10-07 09:31:42 -04:00
parent a5f752f450
commit 21646ee66c
1 changed files with 4 additions and 10 deletions

View File

@ -3,26 +3,20 @@ package scsusers
import (
"crypto/rand"
"encoding/base32"
mr "math/rand"
"time"
"unicode"
)
func flipCoin() bool {
x := make([]byte, 1)
_, err := rand.Read(x)
if err != nil {
return true
}
if uint8(x[0]) % 2==0 {
return true
}
return false
r:=mr.New(mr.NewSource(time.Now().Unix()))
return r.Intn(2)==1
}
func scrambleCase(in []byte) []byte {
var out []byte
for _, x := range string(in) {
if unicode.IsUpper(x) {
if flipCoin() {
out = append(out, byte(x))
} else {