From b3b4278f59a140be6a2ebe7b38e46b1c23d11834 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 23 Jun 2019 23:24:00 +0200 Subject: [PATCH] rand fixes --- rand/rand.v | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rand/rand.v b/rand/rand.v index 0260da44ae..1ff158c66f 100644 --- a/rand/rand.v +++ b/rand/rand.v @@ -5,14 +5,18 @@ module rand #include -// #include + +struct C.time_t{} +fn C.rand() int + fn seed() { # time_t t; # srand((unsigned) time(&t)); } fn next(max int) int { - # return rand() % max; - return 0 + r := 0 + # r = rand(); // TODO parser bug `rand` module name conflict + return r % max }