diff options
Diffstat (limited to 'pkg/rand/rand.go')
-rw-r--r-- | pkg/rand/rand.go | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/pkg/rand/rand.go b/pkg/rand/rand.go index 37ac07620..e81f0f5db 100644 --- a/pkg/rand/rand.go +++ b/pkg/rand/rand.go @@ -12,28 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build !linux + // Package rand implements a cryptographically secure pseudorandom number // generator. package rand -import ( - "io" - - "golang.org/x/sys/unix" -) - -// reader implements an io.Reader that returns pseudorandom bytes. -type reader struct{} - -// Read implements io.Reader.Read. -func (reader) Read(p []byte) (int, error) { - return unix.Getrandom(p, 0) -} +import "crypto/rand" // Reader is the default reader. -var Reader io.Reader = reader{} +var Reader = rand.Reader -// Read reads from the default reader. +// Read implements io.Reader.Read. func Read(b []byte) (int, error) { - return io.ReadFull(Reader, b) + return rand.Read(b) } |