diff options
Diffstat (limited to 'src/cmd/dice')
| -rw-r--r-- | src/cmd/dice/dice.c | 15 | ||||
| -rw-r--r-- | src/cmd/dice/makefile | 10 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/cmd/dice/dice.c b/src/cmd/dice/dice.c new file mode 100644 index 0000000..b31670f --- /dev/null +++ b/src/cmd/dice/dice.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +int +main (void) +{ + int sides = 6; + time_t t; + srand((unsigned) time(&t)); + + printf("%d\n", (rand() % sides) + 1); + + return 0; +} diff --git a/src/cmd/dice/makefile b/src/cmd/dice/makefile new file mode 100644 index 0000000..5c0e384 --- /dev/null +++ b/src/cmd/dice/makefile @@ -0,0 +1,10 @@ +all: dice + @cp dice $(PROROOT)/build/bin/dice + +dice: dice.c + $(CC) -o dice dice.c + +clean: + @rm -r dice + +.PHONY: all clean
\ No newline at end of file |
