package utils

import (
	"math/rand"
	"strings"
)

const (
	charset        = "abcdefghijklmnopqrstuvwxyz0123456789"
	charsetNumbers = "0123456789"
)

func RandomString(length int) string {
	sb := strings.Builder{}
	sb.Grow(length)
	for i := 0; i < length; i++ {
		sb.WriteByte(charset[rand.Intn(len(charset))])
	}
	return sb.String()
}

func RandomStringNumbers(length int) string {
	sb := strings.Builder{}
	sb.Grow(length)
	for range length {
		sb.WriteByte(charsetNumbers[rand.Intn(len(charsetNumbers))])
	}

	return sb.String()
}
