rust-raspberrypi-OS-tutorials/08_random
Andre Richter fd4c62f9e8
Fix strange dockcross path changes
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
2018-05-07 22:44:44 +02:00
..
raspi3_glue Add timer tutorial 2018-04-19 18:46:24 +02:00
src Add Deref trait in the spirit of cortex-m peripherals 2018-04-13 22:05:50 +02:00
aarch64-raspi3-none-elf.json Introduce abstraction tut, shuffle tut numbers again 2018-04-12 22:21:03 +02:00
Cargo.lock Add timer tutorial 2018-04-19 18:46:24 +02:00
Cargo.toml Add timer tutorial 2018-04-19 18:46:24 +02:00
kernel8.img Add Deref trait in the spirit of cortex-m peripherals 2018-04-13 22:05:50 +02:00
link.ld Introduce abstraction tut, shuffle tut numbers again 2018-04-12 22:21:03 +02:00
Makefile Fix strange dockcross path changes 2018-05-07 22:44:44 +02:00
README.md Introduce abstraction tut, shuffle tut numbers again 2018-04-12 22:21:03 +02:00

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.