diff --git a/examples/3d/spotlight.rs b/examples/3d/spotlight.rs index 750478d03893b..cee0a6de69a1b 100644 --- a/examples/3d/spotlight.rs +++ b/examples/3d/spotlight.rs @@ -49,6 +49,9 @@ fn setup( )); // cubes + + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut rng = ChaCha8Rng::seed_from_u64(19878367467713); let cube_mesh = meshes.add(Cuboid::new(0.5, 0.5, 0.5)); let blue = materials.add(Color::srgb_u8(124, 144, 255)); diff --git a/examples/animation/custom_skinned_mesh.rs b/examples/animation/custom_skinned_mesh.rs index 0bc26faabf664..cc41ef6a63e71 100644 --- a/examples/animation/custom_skinned_mesh.rs +++ b/examples/animation/custom_skinned_mesh.rs @@ -123,6 +123,8 @@ fn setup( let mesh = meshes.add(mesh); + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut rng = ChaCha8Rng::seed_from_u64(42); for i in -5..5 { diff --git a/examples/async_tasks/external_source_external_thread.rs b/examples/async_tasks/external_source_external_thread.rs index c28747bd0c540..0fecded7b6b46 100644 --- a/examples/async_tasks/external_source_external_thread.rs +++ b/examples/async_tasks/external_source_external_thread.rs @@ -27,6 +27,8 @@ fn setup(mut commands: Commands) { let (tx, rx) = bounded::(10); std::thread::spawn(move || { + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut rng = ChaCha8Rng::seed_from_u64(19878367467713); loop { // Everything here happens in another thread diff --git a/examples/ecs/iter_combinations.rs b/examples/ecs/iter_combinations.rs index d92737f784963..698d2961c31cd 100644 --- a/examples/ecs/iter_combinations.rs +++ b/examples/ecs/iter_combinations.rs @@ -45,6 +45,8 @@ fn generate_bodies( let color_range = 0.5..1.0; let vel_range = -0.5..0.5; + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut rng = ChaCha8Rng::seed_from_u64(19878367467713); for _ in 0..NUM_BODIES { let radius: f32 = rng.gen_range(0.1..0.7); diff --git a/examples/ecs/parallel_query.rs b/examples/ecs/parallel_query.rs index d9449c08c159a..ece2c5d7820bc 100644 --- a/examples/ecs/parallel_query.rs +++ b/examples/ecs/parallel_query.rs @@ -11,6 +11,9 @@ struct Velocity(Vec2); fn spawn_system(mut commands: Commands, asset_server: Res) { commands.spawn(Camera2dBundle::default()); let texture = asset_server.load("branding/icon.png"); + + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut rng = ChaCha8Rng::seed_from_u64(19878367467713); for _ in 0..128 { commands.spawn(( diff --git a/examples/games/alien_cake_addict.rs b/examples/games/alien_cake_addict.rs index 02a02d9631261..721cf9bbba671 100644 --- a/examples/games/alien_cake_addict.rs +++ b/examples/games/alien_cake_addict.rs @@ -110,7 +110,8 @@ fn setup_cameras(mut commands: Commands, mut game: ResMut) { fn setup(mut commands: Commands, asset_server: Res, mut game: ResMut) { let mut rng = if std::env::var("GITHUB_ACTIONS") == Ok("true".to_string()) { - // Make the game play out the same way every time, this is useful for testing purposes. + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. ChaCha8Rng::seed_from_u64(19878367467713) } else { ChaCha8Rng::from_entropy() diff --git a/examples/gizmos/axes.rs b/examples/gizmos/axes.rs index 033b65dbfab66..9ef4b81593232 100644 --- a/examples/gizmos/axes.rs +++ b/examples/gizmos/axes.rs @@ -42,6 +42,8 @@ fn setup( mut meshes: ResMut>, mut materials: ResMut>, ) { + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut rng = ChaCha8Rng::seed_from_u64(19878367467713); // Lights... diff --git a/examples/stress_tests/bevymark.rs b/examples/stress_tests/bevymark.rs index 136632c10bd5a..067f761507cd9 100644 --- a/examples/stress_tests/bevymark.rs +++ b/examples/stress_tests/bevymark.rs @@ -222,6 +222,8 @@ fn setup( quad: meshes .add(Rectangle::from_size(Vec2::splat(BIRD_TEXTURE_SIZE as f32))) .into(), + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. color_rng: ChaCha8Rng::seed_from_u64(42), material_rng: ChaCha8Rng::seed_from_u64(42), velocity_rng: ChaCha8Rng::seed_from_u64(42), @@ -305,6 +307,8 @@ fn mouse_handler( mut wave: Local, ) { if rng.is_none() { + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. *rng = Some(ChaCha8Rng::seed_from_u64(42)); } let rng = rng.as_mut().unwrap(); @@ -538,6 +542,8 @@ fn counter_system( } fn init_textures(textures: &mut Vec>, args: &Args, images: &mut Assets) { + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut color_rng = ChaCha8Rng::seed_from_u64(42); while textures.len() < args.material_texture_count { let pixel = [color_rng.gen(), color_rng.gen(), color_rng.gen(), 255]; @@ -573,6 +579,8 @@ fn init_materials( texture: textures.first().cloned(), })); + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut color_rng = ChaCha8Rng::seed_from_u64(42); let mut texture_rng = ChaCha8Rng::seed_from_u64(42); materials.extend( diff --git a/examples/stress_tests/many_cubes.rs b/examples/stress_tests/many_cubes.rs index b1f9c0a79eaa1..d0079d4eff7e3 100644 --- a/examples/stress_tests/many_cubes.rs +++ b/examples/stress_tests/many_cubes.rs @@ -124,6 +124,8 @@ fn setup( let material_textures = init_textures(args, images); let materials = init_materials(args, &material_textures, material_assets); + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut material_rng = ChaCha8Rng::seed_from_u64(42); match args.layout { Layout::Sphere => { @@ -203,6 +205,8 @@ fn setup( } fn init_textures(args: &Args, images: &mut Assets) -> Vec> { + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut color_rng = ChaCha8Rng::seed_from_u64(42); let color_bytes: Vec = (0..(args.material_texture_count * 4)) .map(|i| if (i % 4) == 3 { 255 } else { color_rng.gen() }) @@ -247,6 +251,8 @@ fn init_materials( ..default() })); + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut color_rng = ChaCha8Rng::seed_from_u64(42); let mut texture_rng = ChaCha8Rng::seed_from_u64(42); materials.extend( diff --git a/examples/transforms/align.rs b/examples/transforms/align.rs index 242f437d98428..37dd13a079b2b 100644 --- a/examples/transforms/align.rs +++ b/examples/transforms/align.rs @@ -54,6 +54,8 @@ fn setup( mut meshes: ResMut>, mut materials: ResMut>, ) { + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. let mut seeded_rng = ChaCha8Rng::seed_from_u64(19878367467712); // A camera looking at the origin diff --git a/examples/ui/font_atlas_debug.rs b/examples/ui/font_atlas_debug.rs index 2179e3cf0cdd7..12da643fea335 100644 --- a/examples/ui/font_atlas_debug.rs +++ b/examples/ui/font_atlas_debug.rs @@ -105,5 +105,7 @@ fn setup(mut commands: Commands, asset_server: Res, mut state: ResM }, )); }); + // We're seeding the PRNG here to make this example deterministic for testing purposes. + // This isn't strictly required in practical use unless you need your app to be deterministic. commands.insert_resource(SeededRng(ChaCha8Rng::seed_from_u64(19878367467713))); }