Hacker News new | ask | show | jobs
by rmcpherson 3899 days ago
I noticed that the lissajous program in 1.4, as included, generates non-random lissajous figures since the random number generator is not seeded. I couldn't find any reference to this in the text and this could be confusing to beginning readers. Is there a recommended way to submit errata?
2 comments

You're correct, but in the interest of:

We’ll discuss these topics only briefly here, pushing most details off to later chapters, since the primary goal right now is to give you an idea of what Go looks like...

it's probably clearer to use the default random source.

Good point, but I also think it will be confusing to beginners who compile and run the program only to find that it always generates the same figure without any explanation as to why. Both the package documentation and text say that the generated figures will be random.

The fix is just a couple lines and, I would argue, should be included in the source to eliminate the surprising behavior. http://play.golang.org/p/1WlhOdJ1pk

In the preface it does state:

  To run the examples, you will need at least version 1.5 of Go.

  $ go version
  go version go1.5 linux/amd64

  Follow the instructions at https://golang.org/doc/install if the go tool on your computer is older or missing.
The deterministic rand behavior is the same for all go versions: https://golang.org/pkg/math/rand/#pkg-overview