1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

shred: adapt to API changes of rand

This commit is contained in:
Daniel Hofstetter 2025-01-29 14:59:47 +01:00
parent a5fb8f952b
commit ddb027231f

View file

@ -176,7 +176,7 @@ impl BytesWriter {
fn from_pass_type(pass: &PassType) -> Self { fn from_pass_type(pass: &PassType) -> Self {
match pass { match pass {
PassType::Random => Self::Random { PassType::Random => Self::Random {
rng: StdRng::from_entropy(), rng: StdRng::from_os_rng(),
buffer: [0; BLOCK_SIZE], buffer: [0; BLOCK_SIZE],
}, },
PassType::Pattern(pattern) => { PassType::Pattern(pattern) => {
@ -452,7 +452,7 @@ fn wipe_file(
for pattern in PATTERNS.into_iter().take(remainder) { for pattern in PATTERNS.into_iter().take(remainder) {
pass_sequence.push(PassType::Pattern(pattern)); pass_sequence.push(PassType::Pattern(pattern));
} }
let mut rng = rand::thread_rng(); let mut rng = rand::rng();
pass_sequence.shuffle(&mut rng); // randomize the order of application pass_sequence.shuffle(&mut rng); // randomize the order of application
let n_random = 3 + n_passes / 10; // Minimum 3 random passes; ratio of 10 after let n_random = 3 + n_passes / 10; // Minimum 3 random passes; ratio of 10 after