Skip to content

Instantly share code, notes, and snippets.

@richo
Created July 24, 2015 22:33
Show Gist options
  • Save richo/2e0ee8f0f0d6a453bad1 to your computer and use it in GitHub Desktop.
Save richo/2e0ee8f0f0d6a453bad1 to your computer and use it in GitHub Desktop.
package main
import (
"crypto/rand"
"fmt"
"log"
"math/big"
"os"
)
func main() {
zero, _ := os.Open("/dev/zero")
to := big.NewInt(1 << 62)
for i := 0; i < 100; i++ {
i, err := rand.Int(zero, to)
if err != nil {
log.Fatal("Couldn't get a random number", err)
}
fmt.Printf("%d, ", i)
}
fmt.Println()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment