Handle food (functions to select an emoji from a string).

This commit is contained in:
Sacha Ligthert 2023-11-05 23:49:27 +01:00
parent 650d06167d
commit fc18d74e1f

12
food.go Normal file
View File

@ -0,0 +1,12 @@
package main
import (
"math/rand"
)
func getFoodItem() rune {
var foods string = "🐵🐱🐷🐁🐇🐿🦇🐓🐣🐸🦎🍎🍏"
foodsRune := []rune(foods)
randomIndex := rand.Intn(len(foodsRune))
return foodsRune[randomIndex]
}