rust-raspberrypi-OS-tutorials/06_random
2018-01-13 21:31:34 +01:00
..
gpio.h Initial commit 2018-01-04 18:24:49 +01:00
kernel8.img Fixed issue #2 2018-01-13 21:31:34 +01:00
link.ld Initial commit 2018-01-04 18:24:49 +01:00
main.c Initial commit 2018-01-04 18:24:49 +01:00
Makefile Initial commit 2018-01-04 18:24:49 +01:00
mbox.c Initial commit 2018-01-04 18:24:49 +01:00
mbox.h Initial commit 2018-01-04 18:24:49 +01:00
OLVASSEL.md Initial commit 2018-01-04 18:24:49 +01:00
rand.c Initial commit 2018-01-04 18:24:49 +01:00
rand.h Initial commit 2018-01-04 18:24:49 +01:00
README.md Initial commit 2018-01-04 18:24:49 +01:00
start.S Initial commit 2018-01-04 18:24:49 +01:00
uart.c Fixed issue #2 2018-01-13 21:31:34 +01:00
uart.h Initial commit 2018-01-04 18:24:49 +01:00

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.h, rand.c

rand_init() initializes the hardware.

rand(min,max) returns a random number between min and max.

Main

We query a random value and then we display it on the serial console.