Created
March 24, 2021 16:56
-
-
Save zored/08cfd4f837bd89e50b74d11b4f9671fe to your computer and use it in GitHub Desktop.
Random reader macOS error example
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 ( | |
"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