Skip to content

Instantly share code, notes, and snippets.

@zored
Created March 24, 2021 16:56
Show Gist options
  • Save zored/08cfd4f837bd89e50b74d11b4f9671fe to your computer and use it in GitHub Desktop.
Save zored/08cfd4f837bd89e50b74d11b4f9671fe to your computer and use it in GitHub Desktop.
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