Skip to content

Commit

Permalink
Merge pull request #29 from dtolnay/rand
Browse files Browse the repository at this point in the history
Update rand crate to 0.9 in benchmark
  • Loading branch information
dtolnay authored Jan 28, 2025
2 parents 1e2c8c9 + 3d6a431 commit 4c75cc8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rust-version = "1.31"
[dev-dependencies]
criterion = { version = "0.5", default-features = false }
fst = "0.4"
rand = { version = "0.8", features = ["small_rng"] }
rand = "0.9"
roaring = "0.10"
ucd-trie = { version = "0.1", default-features = false }
unicode-xid = "0.2.6"
Expand Down
6 changes: 3 additions & 3 deletions benches/xid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ mod roaring;
mod trie;

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::distributions::{Bernoulli, Distribution, Uniform};
use rand::distr::{Bernoulli, Distribution, Uniform};
use rand::rngs::SmallRng;
use rand::SeedableRng;
use std::time::Duration;

fn gen_string(p_nonascii: u32) -> String {
let mut rng = SmallRng::from_seed([b'!'; 32]);
let pick_nonascii = Bernoulli::from_ratio(p_nonascii, 100).unwrap();
let ascii = Uniform::new_inclusive('\0', '\x7f');
let nonascii = Uniform::new_inclusive(0x80 as char, char::MAX);
let ascii = Uniform::new_inclusive('\0', '\x7f').unwrap();
let nonascii = Uniform::new_inclusive(0x80 as char, char::MAX).unwrap();

let mut string = String::new();
for _ in 0..500_000 {
Expand Down

0 comments on commit 4c75cc8

Please sign in to comment.