1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/rand/rand.v
Alexander Medvednikov b0a5cac0c0 clean up
2019-06-26 13:17:45 +02:00

23 lines
418 B
Go

// Copyright (c) 2019 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
module rand
#include <time.h>
pub fn seed() {
# time_t t;
# srand((unsigned) time(&t));
}
pub fn next(max int) int {
r := 0
# r = rand(); // TODO parser bug `rand` module name conflict
return r % max
}
struct C.time_t{}
fn C.rand() int