Skip to content
Permalink
Browse files

fix min/max random value assignment to take effect in the random rast…

…er creation
  • Loading branch information
root676 committed Nov 6, 2020
1 parent 19c32a5 commit 2e5276d6149e0c0c48882100be649a446e722525
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/analysis/processing/qgsalgorithmrandomraster.cpp
@@ -272,9 +272,6 @@ bool QgsRandomUniformRasterAlgorithm::prepareRandomParameters( const QVariantMap
mRandomUpperBound = parameterAsDouble( parameters, QStringLiteral( "UPPER_BOUND" ), context );
mRandomLowerBound = parameterAsDouble( parameters, QStringLiteral( "LOWER_BOUND" ), context );

mRandomUniformIntDistribution = std::uniform_int_distribution<long>( mRandomLowerBound, mRandomUpperBound );
mRandomUniformDoubleDistribution = std::uniform_real_distribution<double>( mRandomLowerBound, mRandomUpperBound );

if ( mRandomLowerBound > mRandomUpperBound )
throw QgsProcessingException( QObject::tr( "The chosen lower bound for random number range is greater than the upper bound. The lower bound value must be smaller than the upper bound value." ) );

@@ -346,6 +343,10 @@ bool QgsRandomUniformRasterAlgorithm::prepareRandomParameters( const QVariantMap
default:
break;
}

mRandomUniformIntDistribution = std::uniform_int_distribution<long>( mRandomLowerBound, mRandomUpperBound );
mRandomUniformDoubleDistribution = std::uniform_real_distribution<double>( mRandomLowerBound, mRandomUpperBound );

return true;
}

0 comments on commit 2e5276d

Please sign in to comment.
You can’t perform that action at this time.