Jason Xu 9c5c2813a0 Update QEMU command in all README and Makefile %!s(int64=2) %!d(string=hai) anos
..
Makefile 426205e2a3 Added makefiles for LLVM Clang %!s(int64=5) %!d(string=hai) anos
Makefile.clang 9c5c2813a0 Update QEMU command in all README and Makefile %!s(int64=2) %!d(string=hai) anos
Makefile.gcc 9c5c2813a0 Update QEMU command in all README and Makefile %!s(int64=2) %!d(string=hai) anos
OLVASSEL.md 7ace64ba9f Initial commit %!s(int64=6) %!d(string=hai) anos
README.md 7ace64ba9f Initial commit %!s(int64=6) %!d(string=hai) anos
gpio.h 7ace64ba9f Initial commit %!s(int64=6) %!d(string=hai) anos
kernel8.img b9e94a8303 Ensure enough entropy available when reading from hardware random generator %!s(int64=4) %!d(string=hai) anos
link.ld 7ace64ba9f Initial commit %!s(int64=6) %!d(string=hai) anos
main.c 7ace64ba9f Initial commit %!s(int64=6) %!d(string=hai) anos
mbox.c 214885df63 compute the mailbox cmd only once %!s(int64=6) %!d(string=hai) anos
mbox.h 7ace64ba9f Initial commit %!s(int64=6) %!d(string=hai) anos
rand.c b9e94a8303 Ensure enough entropy available when reading from hardware random generator %!s(int64=4) %!d(string=hai) anos
rand.h 7ace64ba9f Initial commit %!s(int64=6) %!d(string=hai) anos
start.S ea4691947c Improve comments wrt stack setup %!s(int64=3) %!d(string=hai) anos
uart.c c59ad439f4 Enable UART0 FIFOs %!s(int64=3) %!d(string=hai) anos
uart.h 7ace64ba9f Initial commit %!s(int64=6) %!d(string=hai) anos

README.md

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.