diff --git a/vlib/crypto/rand/rand_darwin.c.v b/vlib/crypto/rand/rand_darwin.c.v index 1053753c657ddb..60158af3164225 100644 --- a/vlib/crypto/rand/rand_darwin.c.v +++ b/vlib/crypto/rand/rand_darwin.c.v @@ -4,16 +4,14 @@ module rand -#include +#include -#flag darwin -framework Security - -fn C.SecRandomCopyBytes(rnd C.SecRandomRef, count usize, bytes voidptr) int +fn C.getentropy(buf voidptr, buflen usize) int // read returns an array of `bytes_needed` random bytes read from the OS. pub fn read(bytes_needed int) ![]u8 { mut buffer := []u8{len: bytes_needed} - status := C.SecRandomCopyBytes(C.SecRandomRef(0), bytes_needed, buffer.data) + status := C.getentropy(buffer.data, bytes_needed) if status != 0 { return &ReadError{} }