pub fn fill_bytes(dest: &mut [u8])
rand-expand
rand
用随机字节填充切片。
按 8 字节分块以小端序写入(每块取一次 next 输出), 尾部不足 8 字节时截取新一次输出的前缀。
next
需要启用 "rand-expand" 特性。
"rand-expand"
use lib_unknown::rand::fill_bytes; let mut buf = [0u8; 16]; fill_bytes(&mut buf); assert_eq!(buf.len(), 16);