cgo2.go 342 B

12345678910111213141516171819202122
  1. // Copyright 2012 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package rand2
  5. /*
  6. #include <stdlib.h>
  7. */
  8. import "C"
  9. func Random() int {
  10. var r C.int = C.rand()
  11. return int(r)
  12. }
  13. // STOP OMIT
  14. func Seed(i int) {
  15. C.srand(C.uint(i))
  16. }
  17. // END OMIT