Generating Random Strings

Let’s learn about random string generation in Go.

Imagine that we want to generate random strings that can be used as difficult-to-guess passwords or for testing purposes. Based on random number generation, we create a utility that produces random strings.

Random string generation utility in Go

The utility is implemented as the genPass.go program.

Coding example

The core functionality of genPass.go is found in the next function.

Get hands-on with 1200+ tech skills courses.