diff options
-rw-r--r-- | kgramstats.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kgramstats.cpp b/kgramstats.cpp index af24606..48e4b06 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp | |||
@@ -428,7 +428,8 @@ std::string kgramstats::randomSentence(int n) | |||
428 | { | 428 | { |
429 | while ((cur.size() > 1) && (cuts > 0)) | 429 | while ((cur.size() > 1) && (cuts > 0)) |
430 | { | 430 | { |
431 | if ((rand() % cuts) > (maxK - cur.size() + 1)) | 431 | int under = maxK - cur.size() + 1; |
432 | if ((rand() % cuts) > (under * under)) | ||
432 | { | 433 | { |
433 | cur.pop_front(); | 434 | cur.pop_front(); |
434 | cuts--; | 435 | cuts--; |