Jason Xu 9c5c2813a0 Update QEMU command in all README and Makefile | %!s(int64=2) %!d(string=hai) anos | |
---|---|---|
.. | ||
Makefile | %!s(int64=5) %!d(string=hai) anos | |
Makefile.clang | %!s(int64=2) %!d(string=hai) anos | |
Makefile.gcc | %!s(int64=2) %!d(string=hai) anos | |
OLVASSEL.md | %!s(int64=6) %!d(string=hai) anos | |
README.md | %!s(int64=6) %!d(string=hai) anos | |
gpio.h | %!s(int64=6) %!d(string=hai) anos | |
kernel8.img | %!s(int64=4) %!d(string=hai) anos | |
link.ld | %!s(int64=6) %!d(string=hai) anos | |
main.c | %!s(int64=6) %!d(string=hai) anos | |
mbox.c | %!s(int64=6) %!d(string=hai) anos | |
mbox.h | %!s(int64=6) %!d(string=hai) anos | |
rand.c | %!s(int64=4) %!d(string=hai) anos | |
rand.h | %!s(int64=6) %!d(string=hai) anos | |
start.S | %!s(int64=3) %!d(string=hai) anos | |
uart.c | %!s(int64=3) %!d(string=hai) anos | |
uart.h | %!s(int64=6) %!d(string=hai) anos |
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.