Created
August 1, 2016 20:06
-
-
Save joshheinrichs/59cd6c6f5eabb8c4d3f8b2efbe88697c to your computer and use it in GitHub Desktop.
Since Go's math/rand package does not implement Uint64, this shows a simple way to add it yourself.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
// Uint64 returns a pseudo-random 64-bit value as a uint64 | |
// from the default Source. | |
func Uint64() uint64 { | |
return uint64(rand.Uint32())<<32 | uint64(rand.Uint32()) | |
} | |
func main() { | |
fmt.Printf("%b\n", Uint64()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment