Skip to content

Instantly share code, notes, and snippets.

@raecoo
Created January 15, 2018 07:11
Show Gist options
  • Save raecoo/804058234ce47545e5a75561e342fbab to your computer and use it in GitHub Desktop.
Save raecoo/804058234ce47545e5a75561e342fbab to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"crypto/rand"
"math/big"
)
func Int64() (s int64, err error) {
bi := big.NewInt(9223372036854775807)
r, err := rand.Int(rand.Reader, bi)
if err != nil {
return
}
s = r.Int64()
return
}
func main() {
for i := 0; i < 10; i++ {
i, err := Int64()
fmt.Println(i, err)
}
}
package main
import(
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
for i := 0; i < 10; i++ {
fmt.Println(rand.Uint64())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment