aboutsummaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2022-10-04 12:20:18 -0400
committerGopher Robot <gobot@golang.org>2022-10-25 16:49:48 +0000
commit90a67d052e6dc3f9d522820ca60cc9862a8016ba (patch)
tree85daf9c53fedd5f705b3b38244be626916c2e758 /src/debug
parent4c9006e45f7c2ab51328868bf2894c3eba7ac3e6 (diff)
downloadgo-90a67d052e6dc3f9d522820ca60cc9862a8016ba.tar.xz
math/rand: auto-seed global source
Implement proposal #54880, to automatically seed the global source. The justification for this not being a breaking change is that any use of the global source in a package's init function or exported API clearly must be valid - that is, if a package changes how much randomness it consumes at init time or in an exported API, that clearly isn't the kind of breaking change that requires issuing a v2 of that package. That kind of per-package change in the position of the global source is indistinguishable from seeding the global source differently. So if the per-package change is valid, so is auto-seeding. And then, of course, auto-seeding means that packages will be far less likely to depend on the specific results of the global source and therefore not break when those kinds of per-package changes happen in the future. Seed(1) can be called in programs that need the old sequence from the global source and want to restore the old behavior. Of course, those programs will still be broken by the per-package changes just described, and it would be better for them to allocate local sources rather than continue to use the global one. Fixes #54880. Change-Id: Ib9dc3307b97f7a45587a9cc50d81f919d3edc7ae Reviewed-on: https://go-review.googlesource.com/c/go/+/443058 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/debug')
0 files changed, 0 insertions, 0 deletions