Skip to content

Commit 77763b1

Browse files
authored
Remove getrandom from examples (#7194)
1 parent a8af685 commit 77763b1

File tree

4 files changed

+3
-10
lines changed

4 files changed

+3
-10
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ env_logger = "0.11"
9898
fern = "0.7"
9999
flume = "0.11"
100100
futures-lite = "2"
101-
getrandom = "0.2"
102101
glam = "0.29"
103102
hashbrown = { version = "0.14.5", default-features = false, features = [
104103
"ahash",

examples/features/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ bytemuck.workspace = true
3535
cfg-if.workspace = true
3636
encase = { workspace = true, features = ["glam"] }
3737
flume.workspace = true
38-
getrandom.workspace = true
3938
glam = { workspace = true, features = ["bytemuck"] }
4039
ktx2.workspace = true
4140
log.workspace = true

examples/features/src/repeated_compute/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
//! hello-compute example does not such as mapping buffers
66
//! and why use the async channels.
77
8+
use nanorand::Rng;
9+
810
const OVERFLOW: u32 = 0xffffffff;
911

1012
async fn run() {
@@ -13,7 +15,7 @@ async fn run() {
1315

1416
for _ in 0..10 {
1517
for p in numbers.iter_mut() {
16-
*p = generate_rand() as u32;
18+
*p = nanorand::tls_rng().generate::<u16>() as u32;
1719
}
1820

1921
compute(&mut numbers, &context).await;
@@ -29,12 +31,6 @@ async fn run() {
2931
}
3032
}
3133

32-
fn generate_rand() -> u16 {
33-
let mut bytes = [0u8; 2];
34-
getrandom::getrandom(&mut bytes[..]).unwrap();
35-
u16::from_le_bytes(bytes)
36-
}
37-
3834
async fn compute(local_buffer: &mut [u32], context: &WgpuContext) {
3935
log::info!("Beginning GPU compute on data {local_buffer:?}.");
4036
// Local buffer contents -> GPU storage buffer

0 commit comments

Comments
 (0)