diff --git a/efsity/src/main/java/org/smartregister/command/QuestionnaireResponseGeneratorCommand.java b/efsity/src/main/java/org/smartregister/command/QuestionnaireResponseGeneratorCommand.java index 8e0ee2d..3629168 100644 --- a/efsity/src/main/java/org/smartregister/command/QuestionnaireResponseGeneratorCommand.java +++ b/efsity/src/main/java/org/smartregister/command/QuestionnaireResponseGeneratorCommand.java @@ -457,7 +457,7 @@ private static String aiGenerated( } public static double getRandomNumber(T bound) { - return random.nextDouble() * bound.doubleValue(); + return random.nextDouble() * (bound.doubleValue() - 1); } public static double getRandomNumber(T origin, T bound) { @@ -468,7 +468,7 @@ public static double getRandomNumber(T origin, T bound) { throw new IllegalArgumentException("Origin must be less than bound"); } - return originValue + random.nextDouble() * (boundValue - originValue); + return originValue + random.nextDouble() * (boundValue - (originValue + 1)); } public static class Constants {