From 0f717faf2fddb67d935dce057cbdbdc6a6925e83 Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Wed, 20 Dec 2023 22:38:47 +0100 Subject: love: add rng --- stage3/shell.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/stage3/shell.c b/stage3/shell.c index 6aca52d..d67ca57 100644 --- a/stage3/shell.c +++ b/stage3/shell.c @@ -137,10 +137,18 @@ static void cmd_clear(str arg) font_clear_screen(); } +int rand() +{ + static unsigned long int next = 1; + + next = next * 1103515245 + 12345; + return (unsigned int) (next/65535) % 32768; +} + static void cmd_love(str arg) { if (arg.len == 0) - arg = S("anna"); + arg = (rand()%2) ? S("anna") : S("floof"); str f = fs_read(S("uwu.txt")); if (f.data == nil) { -- cgit v1.2.3