Run rustfmt.
This commit is contained in:
@ -3,13 +3,10 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use embassy::executor::Spawner;
|
||||
use embassy_nrf::interrupt;
|
||||
use embassy_nrf::rng::Rng;
|
||||
use embassy_nrf::Peripherals;
|
||||
use embassy_nrf::{interrupt, Peripherals};
|
||||
use rand::Rng as _;
|
||||
|
||||
use defmt_rtt as _; // global logger
|
||||
use panic_probe as _;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy::main]
|
||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
@ -27,12 +24,6 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
rng.fill_bytes(&mut bytes).await;
|
||||
let zero_count: u32 = bytes.iter().fold(0, |acc, val| acc + val.count_zeros());
|
||||
let one_count: u32 = bytes.iter().fold(0, |acc, val| acc + val.count_ones());
|
||||
defmt::info!(
|
||||
"Chance of zero: {}%",
|
||||
zero_count * 100 / (bytes.len() as u32 * 8)
|
||||
);
|
||||
defmt::info!(
|
||||
"Chance of one: {}%",
|
||||
one_count * 100 / (bytes.len() as u32 * 8)
|
||||
);
|
||||
defmt::info!("Chance of zero: {}%", zero_count * 100 / (bytes.len() as u32 * 8));
|
||||
defmt::info!("Chance of one: {}%", one_count * 100 / (bytes.len() as u32 * 8));
|
||||
}
|
||||
|
Reference in New Issue
Block a user