-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
[jkayser@oel7latest exercise7.3]$ go version
go version go1.9 linux/amd64
[jkayser@oel7latest exercise7.3]$
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
[jkayser@oel7latest exercise7.3]$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jkayser"
GORACE=""
GOROOT="/usr/local/go1.9"
GOTOOLDIR="/usr/local/go1.9/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build505664125=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
[jkayser@oel7latest exercise7.3]$
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
I was doing Exercise 7.3 in the Go Programming Language book. It has you modify the code from section 4.4 (treesort). When I added code to dump the tree structure (prior to sorting) it dumps the same structure every time. I think the structure is supposed to be randomly populated, but the math.random is generating the same random numbers every time.
https://github.com/adonovan/gopl.io/blob/master/ch4/treesort/sort_test.go
What did you expect to see?
Somewhat ramdomness in the generated numbers, even if they were not cryptographically secure.
What did you see instead?
The same random numbers generated every time.