mirror of
https://github.com/rust-embedded/rust-raspberrypi-OS-tutorials.git
synced 2024-11-03 15:40:21 +00:00
fd4c62f9e8
There were some strange changes to the aarch64 dockross image lately. Looks like unintentional path changes. I'll adapt for now, but hopefully this gets reverted to a sane state soon. Referenece: https://github.com/dockcross/dockcross/pull/221#issuecomment-387188681 |
||
---|---|---|
.. | ||
raspi3_glue | ||
src | ||
aarch64-raspi3-none-elf.json | ||
Cargo.lock | ||
Cargo.toml | ||
kernel8.img | ||
link.ld | ||
Makefile | ||
README.md |
Tutorial 08 - 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.