mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-28 17:04:34 +00:00
Having the OS/runtime provide a cryptographic entropy source is the right thing to do, and we need it to initialize the default random number generator.
21 lines
412 B
Odin
21 lines
412 B
Odin
package runtime
|
|
|
|
_OS_Errno :: distinct int
|
|
|
|
HAS_RAND_BYTES :: _HAS_RAND_BYTES
|
|
|
|
stderr_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) {
|
|
return _stderr_write(data)
|
|
}
|
|
|
|
rand_bytes :: proc "contextless" (dst: []byte) {
|
|
when HAS_RAND_BYTES {
|
|
_rand_bytes(dst)
|
|
} else {
|
|
panic_contextless("base/runtime: no runtime entropy source")
|
|
}
|
|
}
|
|
|
|
exit :: proc "contextless" (code: int) -> ! {
|
|
_exit(code)
|
|
} |