amazing random driver update

This commit is contained in:
koniifer 2024-09-12 19:44:27 +01:00
parent c2183d5138
commit e577572299

View file

@ -103,15 +103,17 @@ pub fn spin_loop() -> ! {
} }
} }
static mut A_REAL_RANDOM_U64_I_PROMISE: u64 = 0;
pub fn hardware_random_u64() -> u64 { pub fn hardware_random_u64() -> u64 {
if let Some(rng) = aarch64_cpu::asm::random::ArmRng::new() { if let Some(rng) = aarch64_cpu::asm::random::ArmRng::new() {
if let Some(rnd) = rng.rndr() { if let Some(rnd) = rng.rndr() {
rnd return rnd;
} else {
panic!("RNG failure :(")
} }
} else { }
panic!("RNDR failure :(((") unsafe {
A_REAL_RANDOM_U64_I_PROMISE += 1;
A_REAL_RANDOM_U64_I_PROMISE
} }
} }