package utils

import (
	"strings"
)

func UpFirstLetter(text string) string {
	data := []rune(text)
	return strings.ToUpper(string(data[0])) + string(data[1:])
}

func RandomString(alphabet string, width int) string {
	return string(RandomRune([]rune(alphabet), width))
}

func RandomRune(alphabet []rune, width int) []rune {
	max := len(alphabet)
	buff := make([]rune, 0, max)
	for i := 0; i < width; i++ {
		buff = append(buff, alphabet[IntN(max)])
	}
	return buff
}
