rand.Seed(SEED) is deprecated, how to use NewRand(NewSeed( ) )?

The Go 1.20 Seed documentation has a typo. Use rand.New(rand.NewSource(seed)) as described in the latest documentation and the Go 1.20 release notes.

Create the random source and use methods on the source instead of calling the package functions:

  r := rand.New(rand.NewSource(seed))
  fmt.Println(r.Uint64())
  fmt.Println(r.Uint64())

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)