aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/examples/rand.rs
blob: e0cfd31374c2e873d4cee90304b71ec1bcbc1ce0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Use rand crate to ensure it's configured for no_std compatbility

#![deny(warnings)]
#![no_main]
#![no_std]

extern crate cortex_m_rt as rt;
use rt::entry;

extern crate panic_semihosting;

extern crate rand;
use rand::Rng;
use rand::SeedableRng;

// the program entry point
#[entry]
fn main() -> ! {
    let seed: [u8; 32] = [0; 32];
    let mut rng = rand::ChaChaRng::from_seed(seed);
    let _ = rng.gen::<u32>();

    loop {}
}