This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlin.random.Random | |
class RandomWordGenerator(words: List<String>) { | |
private val graph = mutableMapOf<Char, MutableSet<Char>>() | |
private val firstLetters = mutableSetOf<Char>() | |
private val lastLetters = mutableSetOf<Char>() | |
init { | |
words.forEach { word -> | |
word.forEachIndexed { index, currentLetter -> |