package password

import "math/rand"

var (
	letters = []rune("abcdefghijklmnopqrstuvwxyz123456789")
)

type service struct{}

func NewPasswordGenerator() IPasswordGenerator {
	return &service{}
}

func (s *service) GeneratePassword(length int) string {
	b := make([]rune, length)
	for i := range b {
		b[i] = letters[rand.Intn(len(letters))]
	}
	return string(b)
}
