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 }