Skip to content

Commit d2dff9b

Browse files
tomassnyalldawson
authored andcommittedApr 7, 2021
Natural Breaks (Jenks) classification causes crash (#42618)
1 parent 2d4f73d commit d2dff9b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/core/classification/qgsclassificationjenks.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,11 @@ QList<double> QgsClassificationJenks::calculateBreaks( double &minimum, double &
9999

100100
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
101101
double r = QRandomGenerator::global()->generate();
102+
int j = std::floor( r / QRandomGenerator::max() * ( values.size() - 1 ) );
102103
#else
103104
double r = qrand();
104-
#endif
105105
int j = std::floor( r / RAND_MAX * ( values.size() - 1 ) );
106+
#endif
106107
sample[ i ] = values[ j ];
107108
}
108109
}

0 commit comments

Comments
 (0)
Please sign in to comment.