github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/doc/progs/cgo2.go (about)

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