From 3d284b88f4682ebaffe3680fdb9d63c6ad4ec7e0 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Sun, 10 Oct 2021 19:24:20 -0400 Subject: Initial Commit --- src/cmd/dice/dice.c | 15 +++++++++++++++ src/cmd/dice/makefile | 10 ++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/cmd/dice/dice.c create mode 100644 src/cmd/dice/makefile (limited to 'src/cmd/dice') 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 +#include +#include + +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 -- cgit v1.2.3