aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/examples/rand.rs
blob: ec3afaae9a22d12e6962cf779900751caa991a51 (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_halt;

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 {}
}