Created
July 18, 2018 10:04
-
-
Save dineybomfim/81e17fa80d92313d1877a1db93f5fdbc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func buildWords(with text: inout String, length: Int, chain: Matrix<String>) { | |
var word = text | |
(0...length).forEach { _ in | |
if let next = chain.next(given: word, process: .weightedRandom) { | |
text.append(" \(next)") | |
word = next | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment