mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
rand fixes
This commit is contained in:
parent
35cef79149
commit
b3b4278f59
10
rand/rand.v
10
rand/rand.v
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user