// Copyright 2025 BackendServerTemplate Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package randomutils import ( "math/rand" "time" ) // GenerateRandomString generates a random string of the specified length // containing lowercase letters ('a'-'z') and digits ('0'-'9'). func GenerateRandomString(length int) string { const charset = "abcdefghijklmnopqrstuvwxyz0123456789" seededRand := rand.New(rand.NewSource(time.Now().UnixNano())) result := make([]byte, length) for i := range result { result[i] = charset[seededRand.Intn(len(charset))] } return string(result) }