Skip to content

Instantly share code, notes, and snippets.

@zored
Created March 24, 2021 16:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Random reader macOS error example
package main
import (
"crypto/rand"
"fmt"
)
func main() {
for i := 1; i <= 10000; i++ {
n, err := rand.Reader.Read(make([]byte, 10))
if n != 10 && err == nil {
fmt.Printf("expected n=10, actial n=%d on i=%d", n, i)
return
}
}
fmt.Printf("ok")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment