aboutsummaryrefslogtreecommitdiff
path: root/core/math/rand/system_windows.odin
blob: c6d68816d915f821e3531ee30fbe04f4c8510327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
package rand

import win32 "core:sys/windows"

@(require_results)
_system_random :: proc() -> u64 {
	value: u64
	status := win32.BCryptGenRandom(nil, ([^]u8)(&value), size_of(value), win32.BCRYPT_USE_SYSTEM_PREFERRED_RNG)
	if status < 0 {
		panic("BCryptGenRandom failed")
	}
	return value
}