Source file src/crypto/rand/rand_darwin.go
1 // Copyright 2024 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package rand 6 7 import "internal/syscall/unix" 8 9 func init() { 10 // arc4random_buf is the recommended application CSPRNG, accepts buffers of 11 // any size, and never returns an error. 12 // 13 // "The subsystem is re-seeded from the kernel random number subsystem on a 14 // regular basis, and also upon fork(2)." - arc4random(3) 15 // 16 // Note that despite its legacy name, it uses a secure CSPRNG (not RC4) in 17 // all supported macOS versions. 18 altGetRandom = func(b []byte) error { unix.ARC4Random(b); return nil } 19 } 20