-
Notifications
You must be signed in to change notification settings - Fork 0
Random Data
Prajwal Koirala edited this page Jul 4, 2021
·
3 revisions
package main
import (
"crypto/rand"
"fmt"
"os"
)
func main() {
os.WriteFile("random-test-file", []byte(randomString(256)), 0644)
}
func randomString(bytesize int) string {
randomBytes := make([]byte, bytesize)
rand.Read(randomBytes)
randomString := fmt.Sprintf("%X", randomBytes)
return randomString
}