Skip to content

Commit

Permalink
build(deps): bump rand to 0.9 (#900)
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Wagner <[email protected]>
  • Loading branch information
nwagner84 authored Feb 5, 2025
1 parent b939078 commit 0785280
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/pica-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ indicatif = { version = "0.17", features = ["improved_unicode"] }
pica-record = { path = "../../", features = ["serde"] }
polars = { version = "0.46", features = ["ipc", "decompress", "lazy"] }
quick-xml = { version = "0.37" }
rand = { version = "0.8" }
rand = { version = "0.9" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
thiserror = { version = "2.0" }
Expand Down
6 changes: 3 additions & 3 deletions crates/pica-cli/src/commands/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::process::ExitCode;
use clap::{value_parser, Parser};
use pica_record::prelude::*;
use rand::rngs::StdRng;
use rand::{thread_rng, Rng, SeedableRng};
use rand::{rng, Rng, SeedableRng};

use crate::config::Config;
use crate::error::CliResult;
Expand Down Expand Up @@ -54,7 +54,7 @@ impl Sample {
.from_path_or_stdout(self.output)?;

let mut rng: StdRng = match self.seed {
None => StdRng::from_rng(thread_rng()).unwrap(),
None => StdRng::from_rng(&mut rng()),
Some(seed) => StdRng::seed_from_u64(seed),
};

Expand Down Expand Up @@ -84,7 +84,7 @@ impl Sample {
if i < sample_size {
reservoir.push(data);
} else {
let j = rng.gen_range(0..i);
let j = rng.random_range(0..i);
if j < sample_size {
reservoir[j] = data;
}
Expand Down
Loading

0 comments on commit 0785280

Please sign in to comment.