1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

rand fixes

This commit is contained in:
Alexander Medvednikov 2019-06-23 23:24:00 +02:00
parent 35cef79149
commit b3b4278f59

View File

@ -5,14 +5,18 @@
module rand
#include <time.h>
// #include <stdlib.h>
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
}