Replace crypto/rand with math/rand/v2 to test

This commit is contained in:
Seednode 2024-02-08 16:37:49 -06:00
parent b17a21b846
commit abc0677b2c
2 changed files with 6 additions and 20 deletions

View File

@ -8,15 +8,11 @@ import (
"errors"
"fmt"
"io/fs"
"math/big"
"regexp"
"runtime"
"slices"
"crypto/rand"
"math/rand/v2"
"os"
"path/filepath"
"strconv"
"runtime"
"slices"
"strings"
"sync"
"time"
@ -464,17 +460,7 @@ func pickFile(list []string) (string, error) {
return "", ErrNoMediaFound
}
r, err := rand.Int(rand.Reader, big.NewInt(int64(fileCount)))
if err != nil {
return "", err
}
val, err := strconv.Atoi(strconv.FormatInt(r.Int64(), 10))
if err != nil {
return "", err
}
return list[val], nil
return list[rand.IntN(fileCount)], nil
}
func preparePath(prefix, path string) string {

View File

@ -17,7 +17,7 @@ import (
const (
AllowedCharacters string = `^[A-z0-9.\-_]+$`
ReleaseVersion string = "8.6.1"
ReleaseVersion string = "8.7.0"
)
var (