Skip to content

Commit cf1fe5d

Browse files
Bump rand from 0.8.5 to 0.9.0 (#1065)
* Bump rand from 0.8.5 to 0.9.0 Bumps [rand](https://github.com/rust-random/rand) from 0.8.5 to 0.9.0. - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md) - [Commits](rust-random/rand@0.8.5...0.9.0) --- updated-dependencies: - dependency-name: rand dependency-version: 0.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Fix deprecation warnings --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jeremy Massel <1123407+jkmassel@users.noreply.github.com>
1 parent 5d8a243 commit cf1fe5d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ linkify = "0.10.0"
4848
parse_link_header = "0.4"
4949
paste = "1.0"
5050
proc-macro-crate = "3.4.0"
51-
rand = "0.8"
51+
rand = "0.9"
5252
proc-macro2 = "1.0"
5353
quote = "1.0"
5454
regex = "1.12"

wp_mobile/src/service/mock_post_service.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ fn stress_test_batch_update(
7373
format!("<p>Content updated at batch #{}</p>", current_count);
7474

7575
// Randomize the post status
76-
let mut rng = rand::thread_rng();
77-
let status_index = rng.gen_range(0..STRESS_TEST_STATUS_VALUES.len());
76+
let mut rng = rand::rng();
77+
let status_index = rng.random_range(0..STRESS_TEST_STATUS_VALUES.len());
7878
post.status = STRESS_TEST_STATUS_VALUES[status_index].clone();
7979

8080
repo.upsert(conn, db_site, &post)?;
@@ -389,7 +389,7 @@ impl MockPostService {
389389

390390
thread::spawn(move || {
391391
let repo = PostRepository::<EditContext>::new();
392-
let mut rng = rand::thread_rng();
392+
let mut rng = rand::rng();
393393
let mut next_insert_id: i64 = 20000; // Start IDs for inserted posts
394394

395395
// Calculate total weight for operation selection
@@ -412,11 +412,11 @@ impl MockPostService {
412412
}
413413

414414
// Determine batch size for this iteration
415-
let batch_size = rng.gen_range(config.min_batch_size..=config.max_batch_size);
415+
let batch_size = rng.random_range(config.min_batch_size..=config.max_batch_size);
416416
let batch_size = batch_size.min(entity_ids.len() as u32);
417417

418418
// Choose operation based on weights
419-
let roll = rng.gen_range(0..total_weight);
419+
let roll = rng.random_range(0..total_weight);
420420
let operation = if roll < config.update_weight {
421421
StressTestOperation::Update
422422
} else if roll < config.update_weight + config.delete_weight {
@@ -429,7 +429,7 @@ impl MockPostService {
429429

430430
// Select random posts for this batch
431431
let batch_indices: Vec<usize> = (0..batch_size)
432-
.map(|_| rng.gen_range(0..entity_ids.len()))
432+
.map(|_| rng.random_range(0..entity_ids.len()))
433433
.collect();
434434

435435
match operation {
@@ -462,7 +462,7 @@ impl MockPostService {
462462
}
463463

464464
// Variable delay between batches
465-
let delay_ms = rng.gen_range(config.min_delay_ms..=config.max_delay_ms);
465+
let delay_ms = rng.random_range(config.min_delay_ms..=config.max_delay_ms);
466466
thread::sleep(Duration::from_millis(delay_ms));
467467
}
468468
});

0 commit comments

Comments
 (0)