survivor

graphical action game for the linux terminal
git clone https://git.ce9e.org/survivor.git

commit
fbee65761413620270ecf1961f5d60004b98ef58
parent
29890b20208854ea5574717682e5a973a5f45dd2
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-02-20 20:30
make getrandom types more explicit

Diffstat

M src/random.rs 5 +++--

1 files changed, 3 insertions, 2 deletions


diff --git a/src/random.rs b/src/random.rs

@@ -6,9 +6,10 @@ pub struct Rng {
    6     6 
    7     7 impl Rng {
    8     8     pub fn new() -> Self {
    9    -1         let mut bytes = [0; 8];
   -1     9         let mut bytes = [0u8; 8];
   10    10         unsafe {
   11    -1             libc::getrandom(bytes.as_mut_ptr() as *mut libc::c_void, 8, 0x0001);
   -1    11             let ptr = bytes.as_mut_ptr() as *mut libc::c_void;
   -1    12             libc::getrandom(ptr, bytes.len(), libc::GRND_RANDOM);
   12    13         }
   13    14         return Self {
   14    15             state: u64::from_ne_bytes(bytes),