mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 02:34:42 +00:00
Make rand.Seed not deprecated
This commit is contained in:
parent
c237ee1a47
commit
faf347a44a
6 changed files with 15 additions and 7 deletions
|
|
@ -13,7 +13,7 @@ import (
|
|||
var Version = "?"
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.New(rand.NewSource(time.Now().UnixNano())) // !to remove when bumped to 1.20
|
||||
conf := config.NewConfig()
|
||||
conf.ParseFlags()
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
var Version = "?"
|
||||
|
||||
func run() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.New(rand.NewSource(time.Now().UnixNano())) // !to remove when bumped to 1.20
|
||||
conf := config.NewConfig()
|
||||
conf.ParseFlags()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package zip
|
||||
|
||||
import (
|
||||
cr "crypto/rand"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
|
|
@ -62,10 +63,15 @@ func BenchmarkCompressions(b *testing.B) {
|
|||
{name: "compress", size: 1024 * 1024 * 2},
|
||||
}
|
||||
for _, bm := range benchmarks {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
rand.New(rand.NewSource(time.Now().UnixNano())) // !to remove when bumped to 1.20
|
||||
b.Run(fmt.Sprintf("%v %v", bm.name, bm.size), func(b *testing.B) {
|
||||
b.StopTimer()
|
||||
dat := make([]byte, bm.size)
|
||||
rand.Read(dat)
|
||||
_, err := cr.Read(dat)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.StartTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, _ = Compress(dat, "test")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ func TestStateConcurrency(t *testing.T) {
|
|||
})
|
||||
mock.handleAudio(func(_ *emulator.GameAudio) {})
|
||||
|
||||
rand.Seed(int64(test.seed))
|
||||
rand.New(rand.NewSource(int64(test.seed))) // !to remove when bumped to 1.20
|
||||
t.Logf("Random seed is [%v]\n", test.seed)
|
||||
t.Logf("Save path is [%v]\n", mock.paths.save)
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ func BenchmarkResampler(b *testing.B) {
|
|||
}
|
||||
|
||||
func gen(l int) []int16 {
|
||||
rand.Seed(time.Now().Unix())
|
||||
rand.New(rand.NewSource(time.Now().UnixNano())) // !to remove when bumped to 1.20
|
||||
|
||||
nums := make([]int16, l)
|
||||
for i := range nums {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ type (
|
|||
}
|
||||
)
|
||||
|
||||
func init() { rand.Seed(time.Now().UnixNano()) }
|
||||
func init() {
|
||||
rand.New(rand.NewSource(time.Now().UnixNano())) // !to remove when bumped to 1.20
|
||||
}
|
||||
|
||||
// NewRecording creates new media recorder for the emulator.
|
||||
func NewRecording(meta Meta, log *logger.Logger, opts Options) *Recording {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue