rust-raspberrypi-OS-tutorials/06_random/README.md
2018-04-04 21:46:35 +02:00

18 lines
561 B
Markdown

# Tutorial 06 - Hardware Random Number Generator
This going to be an easy tutorial. We query a number from the (undocumented)
hardware random number generator. You can use this to implement a simple, but
accurate dice throw in any game. It is important as without hardware support
you can only generate pseudo-random numbers.
## rand.s
`Rng::init(&self)` initializes the hardware.
`Rng::rand(&self, min: u32, max: u32)` returns a random number between min and
max.
## main.rs
Press a key to query a random value and then display it on the serial console.