NewPseudoRand returns an instance of math/rand.Rand seeded from crypto/rand and its seed so we can easily and cheaply generate unique streams of numbers. The created object is not safe for concurrent access.
()
| 43 | // and its seed so we can easily and cheaply generate unique streams of |
| 44 | // numbers. The created object is not safe for concurrent access. |
| 45 | func NewPseudoRand() (*rand.Rand, int64) { |
| 46 | seed := time.Now().UnixNano() |
| 47 | return rand.New(rand.NewSource(seed)), seed |
| 48 | } |
| 49 | |
| 50 | // RandBytes returns a byte slice of the given length with random |
| 51 | // data. |