go/src/math/rand
Ian Lance Taylor fb3cf5c686 math/rand: fix raciness in Rand.Read
There are no synchronization points protecting the readVal and readPos
variables. This leads to a race when Read is called concurrently.
Fix this by adding methods to lockedSource, which is the case where
a race matters.

Fixes #16308.

Change-Id: Ic028909955700906b2d71e5c37c02da21b0f4ad9
Reviewed-on: https://go-review.googlesource.com/24852
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-07-11 15:11:44 +00:00
..
example_test.go testing: implement 'Unordered Output' in Examples. 2016-03-09 04:34:41 +00:00
exp.go
normal.go
race_test.go math/rand: fix raciness in Rand.Read 2016-07-11 15:11:44 +00:00
rand.go math/rand: fix raciness in Rand.Read 2016-07-11 15:11:44 +00:00
rand_test.go math/rand: fix io.Reader implementation 2016-06-27 22:18:09 +00:00
regress_test.go math/rand: fix io.Reader implementation 2016-06-27 22:18:09 +00:00
rng.go
zipf.go math/rand: improve NewZipf documentation 2015-07-03 21:39:04 +00:00