// GetRandomWords gets a custom amount of random words for the passed Lobby.
// The words will be chosen from the custom words and the default
// dictionary, depending on the settings specified by the lobbies creator.
GetRandomWords gets a custom amount of random words for the passed Lobby.
The words will be chosen from the custom words and the default
dictionary, depending on the settings specified by the lobbies creator.
// GetRandomWords gets a custom amount of random words for the passed Lobby . // The words will be chosen from the custom words and the default // dictionary depending on the settings specified by the lobbies creator .
func GetRandomWords(wordCount int, lobby *Lobby) []string {
	if lobby.CustomWordsChance > 0 && len(lobby.CustomWords) > 0 {
		if lobby.CustomWordsChance == 100 {
			if len(lobby.CustomWords) >= wordCount {
				return popCustomWords(wordCount, lobby)
			}
			leftOverCustomWords := len(lobby.CustomWords)
			return append(
				popCustomWords(len(lobby.CustomWords), lobby),
				popWordpackWords(wordCount-leftOverCustomWords, lobby)...)
		}
		words := make([]string, 0, wordCount)
		for i := 0; i <= wordCount; i++ {
			if len(lobby.CustomWords) >= 1 && rand.Intn(100)+1 < lobby.CustomWordsChance {
				words = append(words, popCustomWords(1, lobby)...)
			} else {
				words = append(words, popWordpackWords(1, lobby)...)
			}
		}
		return words
	}
	return popWordpackWords(wordCount, lobby)
}
func GetRandomWords ( wordCount int , lobby * Lobby ) [ ] string { if lobby . CustomWordsChance > 0 && len ( lobby . CustomWords ) > 0 { if lobby . CustomWordsChance == 100 { if len ( lobby . CustomWords ) >= wordCount { return popCustomWords ( wordCount , lobby ) } leftOverCustomWords := len ( lobby . CustomWords ) return append ( popCustomWords ( len ( lobby . CustomWords ) , lobby ) , popWordpackWords ( wordCount - leftOverCustomWords , lobby ) ... ) } words := make ( [ ] string , 0 , wordCount ) for i := 0 ; i <= wordCount ; i ++ { if len ( lobby . CustomWords ) >= 1 && rand . Intn ( 100 ) + 1 < lobby . CustomWordsChance { words = append ( words , popCustomWords ( 1 , lobby ) ... ) } else { words = append ( words , popWordpackWords ( 1 , lobby ) ... ) } } return words } return popWordpackWords ( wordCount , lobby ) }
GetRandomWords gets a custom amount of random words for the passed Lobby.
GetRandomWords gets a custom amount of random words for the passed Lobby .
//Always get custom words