Go

Go

Made by DeepSource

Random number generator seed doesn't have enough entropy GO-S1033

Security
Major
a02 cwe-336 cwe-337 owasp top 10 cwe-331

As math/rand uses a statistical random number generator, using a low entropy seed (such as constants and the current system time) may allow an attacker to predict what the following number generated is.

Bad practice

package main

import (
    "math/rand"
    "time"
)

func main() {
    rand.Seed(42)                // constant seeds are bad
    rand.Seed(time.Now().Unix()) // time based seeds don't have sufficient entropy
}

References