Skip to content

Instantly share code, notes, and snippets.

@nicolasparada
Last active October 14, 2021 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolasparada/55f35cd7c2b8955bd03df3a390d5a18b to your computer and use it in GitHub Desktop.
Save nicolasparada/55f35cd7c2b8955bd03df3a390d5a18b to your computer and use it in GitHub Desktop.
Quick and easy way to generate a random string in golang
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano())
randStr := fmt.Sprintf("%x", rand.Int63())
fmt.Println(randStr)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment