We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31f7100 commit 4c62755Copy full SHA for 4c62755
src/rng.rs
@@ -115,7 +115,7 @@ impl crate::hal::blocking::rng::Read for Rng {
115
let mut i = 0usize;
116
while i < buffer.len() {
117
let random_word: u32 = self.get_random_data();
118
- let bytes = unsafe { transmute::<u32, [u8; 4]>(random_word) };
+ let bytes: [u8; 4] = random_word.to_ne_bytes();
119
let n = cmp::min(4, buffer.len() - i);
120
buffer[i..i + n].copy_from_slice(&bytes[..n]);
121
i += n;
0 commit comments