Commit Graph

1 Commits

Author SHA1 Message Date
Joe Tsai
492a476312 internal/detrand: new package for deterministically random functionality
The use of math/rand in serialization is to provide some form of instability
to the output to provide a clear signal to the user that the should not
depend on the the property of stability. However, it is reasonable that users
expect the output for these to be deterministic.

As such, add a detrand package that provides deterministic, yet unstable
randomization functionality.

Since this package hashes the binary, it does impose a small initialization cost:
	Benchmark    100000    20712 ns/op    480 B/op    6 allocs/op

Change-Id: I232d0fea1789a4278079837a67ee2f63474a4364
Reviewed-on: https://go-review.googlesource.com/c/151340
Reviewed-by: Herbie Ong <herbie@google.com>
2018-11-27 02:14:04 +00:00