build(deps): update rand requirement in the cargo-crates group

Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version.

Updates `rand` 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](https://github.com/rust-random/rand/compare/0.8.5...0.9.0)

---
updated-dependencies:
- dependency-name: rand
  dependency-type: direct:production
  dependency-group: cargo-crates
...

Signed-off-by: dependabot[bot] <support@github.com>
reviewable/pr1163/r1
Tamir Duberstein 3 months ago
parent 665d4f20bb
commit d9e014c074
No known key found for this signature in database

@ -87,7 +87,7 @@ proc-macro2 = { version = "1", default-features = false }
proc-macro2-diagnostics = { version = "0.10.1", default-features = false } proc-macro2-diagnostics = { version = "0.10.1", default-features = false }
public-api = { version = "0.43.0", default-features = false } public-api = { version = "0.43.0", default-features = false }
quote = { version = "1", default-features = false } quote = { version = "1", default-features = false }
rand = { version = "0.8", default-features = false } rand = { version = "0.9", default-features = false }
rbpf = { version = "0.3.0", default-features = false } rbpf = { version = "0.3.0", default-features = false }
rustdoc-json = { version = "0.9.0", default-features = false } rustdoc-json = { version = "0.9.0", default-features = false }
rustup-toolchain = { version = "0.1.5", default-features = false } rustup-toolchain = { version = "0.1.5", default-features = false }

@ -22,7 +22,7 @@ libc = { workspace = true }
log = { workspace = true } log = { workspace = true }
netns-rs = { workspace = true } netns-rs = { workspace = true }
object = { workspace = true, features = ["elf", "read_core", "std"] } object = { workspace = true, features = ["elf", "read_core", "std"] }
rand = { workspace = true, features = ["std", "std_rng"] } rand = { workspace = true, features = ["thread_rng"] }
rbpf = { workspace = true } rbpf = { workspace = true }
test-case = { workspace = true } test-case = { workspace = true }
test-log = { workspace = true, features = ["log"] } test-log = { workspace = true, features = ["log"] }

@ -77,8 +77,8 @@ struct WithData(RingBufTest, Vec<u64>);
impl WithData { impl WithData {
fn new(n: usize) -> Self { fn new(n: usize) -> Self {
Self(RingBufTest::new(), { Self(RingBufTest::new(), {
let mut rng = rand::thread_rng(); let mut rng = rand::rng();
std::iter::repeat_with(|| rng.gen()).take(n).collect() std::iter::repeat_with(|| rng.random()).take(n).collect()
}) })
} }
} }
@ -270,13 +270,17 @@ async fn ring_buf_async_no_drop() {
) = WithData::new(RING_BUF_MAX_ENTRIES * 3); ) = WithData::new(RING_BUF_MAX_ENTRIES * 3);
let writer = { let writer = {
let data = data.to_owned(); let mut rng = rand::rng();
let data: Vec<_> = data
.iter()
.copied()
.map(|value| (value, Duration::from_nanos(rng.random_range(0..10))))
.collect();
tokio::spawn(async move { tokio::spawn(async move {
for value in data { for (value, duration) in data {
// Sleep a tad so we feel confident that the consumer will keep up // Sleep a tad so we feel confident that the consumer will keep up
// and no messages will be dropped. // and no messages will be dropped.
let dur = Duration::from_nanos(rand::thread_rng().gen_range(0..10)); sleep(duration).await;
sleep(dur).await;
ring_buf_trigger_ebpf_program(value); ring_buf_trigger_ebpf_program(value);
} }
}) })

Loading…
Cancel
Save