mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1708 Fishbones : Fix use of rand() for orientation of subs on Linux
This commit is contained in:
@@ -711,9 +711,16 @@ std::vector<double> RimFishbonesMultipleSubs::locationsFromStartSpacingAndCount(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFishbonesMultipleSubs::randomValueFromRange(int min, int max)
|
||||
{
|
||||
// See http://www.cplusplus.com/reference/cstdlib/rand/
|
||||
|
||||
int range = abs(max - min);
|
||||
int random_integer = min + int(range*rand() / (RAND_MAX + 1.0));
|
||||
|
||||
|
||||
return random_integer;
|
||||
int randomNumberInRange = rand() % range;
|
||||
|
||||
int randomValue = min + randomNumberInRange;
|
||||
|
||||
return randomValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user