Skip to content

Go:math/rand

Troubleshooting

rand.Seed has been deprecated since Go 1.20

rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator. (SA1019)

다음과 같이 수정:

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

See also