gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/cross-platform/randtest/src/testrand.c
1 /*
2 testrand.c
3 Simple example of how to use random number generator
4 */
5
6 #include <stdio.h>
7 #include <rand.h>
8
9 #include <gbdk/platform.h>
10
11 #include <gbdk/console.h>
12
13 void main(void)
14 {
15 puts("press A...");
16 waitpad(J_A);
17 initarand(sys_time);
18 while(TRUE) {
19 waitpadup();
20 for (uint8_t i = 0; i != 16; i++)
21 printf("r=%x a=%x\n", (uint16_t)rand(), (uint16_t)arand());
22 puts("press A...");
23 waitpad(J_A);
24 }
25 }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.