util/rands: add a cheap non-escaping rand type

math/rand and the current v2 proposal retain a source interface that
means they always heap allocate until some future compiler changes this
constraint. This type is one that can be used on-stack for use cases
like a cheap in-place shuffle with an on-stack random generator.

Updates #17243
Signed-off-by: James Tucker <[email protected]>
This commit is contained in:
James Tucker committed 2024-02-06 12:56:23 -08:00
1 parent 5595b61b96
commit 0207c19137
3 files changed
+263

No files matched your search

+1
View File
@@ -416,6 +416,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
LD golang.org/x/crypto/ssh from tailscale.com/ssh/tailssh+
golang.org/x/exp/constraints from github.com/dblohm7/wingoes/pe+
golang.org/x/exp/maps from tailscale.com/wgengine/magicsock+
golang.org/x/exp/rand from tailscale.com/util/rands
golang.org/x/net/bpf from github.com/mdlayher/genetlink+
golang.org/x/net/dns/dnsmessage from net+
golang.org/x/net/http/httpguts from golang.org/x/net/http2+