func main() { Seed(1000) fmt.Println(int(C.random())) time.Sleep(time.Duration(1) * time.Second) fmt.Println(int(C.random())) fmt.Println("getpid:", int(C.getpid())) C.puts(C.CString("call C puts")) Hello("call C's go wrapper func") C.hello(C.CString("call C hello func")) }
func Seed(semilla int) int { fmt.Println("Semilla ", semilla) valor := C.srandom(C.uint(semilla)) tipo := reflect.TypeOf(valor) fmt.Println("Tipo: ", tipo) return int(C.random()) }
func Random() int { var r C.long = C.random() return int(r) }
func main() { fmt.Println("random int front C:", int(C.random())) }
func Random() int { return int(C.random()) }
func rand() int { return int(C.random()) }
func main() { fmt.Printf("Random from C: %d", int(C.random())) }
func main() { i := C.random() print(i) }