commit a1bf341477f469faaa1f5311f549b4f2c1df0188
parent db458ec8ec1724dc5d36fc9fd3fc715e1c49458e
Author: Petar Yotsev <petar@yotsev.xyz>
Date: Tue, 16 Jun 2020 15:12:16 +0100
Bug fix: length calculation didn't account for initial gram
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.cpp b/main.cpp
@@ -203,7 +203,7 @@ int main(int argc, char** argv)
char next = ngram[cgram][rand() % ngram[cgram].size()];
// generate
- for (int i = 0; i < length || infinite; ++i) {
+ for (int i = 0; i < length - order || infinite; ++i) {
result += next;
cout << next;
cgram = result.substr(result.length() - order, order);