You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
314 B
21 lines
314 B
package crypto |
|
|
|
import ( |
|
"bufio" |
|
"crypto/rand" |
|
"io" |
|
"sync" |
|
) |
|
|
|
var defaultRand struct { |
|
sync.Once |
|
reader io.Reader |
|
} |
|
|
|
// DefaultRand returns default entropy source. |
|
func DefaultRand() io.Reader { |
|
defaultRand.Do(func() { |
|
defaultRand.reader = bufio.NewReaderSize(rand.Reader, 1024) |
|
}) |
|
return rand.Reader |
|
}
|
|
|