rand fixes

pull/480/head
Alexander Medvednikov 2019-06-23 23:24:00 +02:00
parent 35cef79149
commit b3b4278f59
1 changed files with 7 additions and 3 deletions

View File

@ -5,14 +5,18 @@
module rand module rand
#include <time.h> #include <time.h>
// #include <stdlib.h>
struct C.time_t{}
fn C.rand() int
fn seed() { fn seed() {
# time_t t; # time_t t;
# srand((unsigned) time(&t)); # srand((unsigned) time(&t));
} }
fn next(max int) int { fn next(max int) int {
# return rand() % max; r := 0
return 0 # r = rand(); // TODO parser bug `rand` module name conflict
return r % max
} }