Jason Xu 9c5c2813a0 Update QEMU command in all README and Makefile | 2 years ago | |
---|---|---|
.. | ||
Makefile | 5 years ago | |
Makefile.clang | 2 years ago | |
Makefile.gcc | 2 years ago | |
OLVASSEL.md | 6 years ago | |
README.md | 6 years ago | |
gpio.h | 6 years ago | |
kernel8.img | 4 years ago | |
link.ld | 6 years ago | |
main.c | 6 years ago | |
mbox.c | 6 years ago | |
mbox.h | 6 years ago | |
rand.c | 4 years ago | |
rand.h | 6 years ago | |
start.S | 3 years ago | |
uart.c | 3 years ago | |
uart.h | 6 years ago |
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_init()
initializes the hardware.
rand(min,max)
returns a random number between min and max.
We query a random value and then we display it on the serial console.