Jason Xu 9c5c2813a0 Update QEMU command in all README and Makefile | il y a 2 ans | |
---|---|---|
.. | ||
Makefile | il y a 5 ans | |
Makefile.clang | il y a 2 ans | |
Makefile.gcc | il y a 2 ans | |
OLVASSEL.md | il y a 6 ans | |
README.md | il y a 6 ans | |
gpio.h | il y a 6 ans | |
kernel8.img | il y a 4 ans | |
link.ld | il y a 6 ans | |
main.c | il y a 6 ans | |
mbox.c | il y a 6 ans | |
mbox.h | il y a 6 ans | |
rand.c | il y a 4 ans | |
rand.h | il y a 6 ans | |
start.S | il y a 3 ans | |
uart.c | il y a 3 ans | |
uart.h | il y a 6 ans |
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.