Skip to content

Instantly share code, notes, and snippets.

@zored
Created Mar 24, 2021
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