From ce62cb3dc014445309c0c7a24254f2a01c78aad4 Mon Sep 17 00:00:00 2001 From: "@hangga" Date: Sat, 20 Jan 2024 08:51:12 +0700 Subject: [PATCH] using Long.MAX_VALUE --- .../SecureRandomPositiveLongUnitTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-numbers-7/src/test/java/com/baeldung/securerandompositivelong/SecureRandomPositiveLongUnitTest.java b/core-java-modules/core-java-numbers-7/src/test/java/com/baeldung/securerandompositivelong/SecureRandomPositiveLongUnitTest.java index b476a95d99..b70dc50e24 100644 --- a/core-java-modules/core-java-numbers-7/src/test/java/com/baeldung/securerandompositivelong/SecureRandomPositiveLongUnitTest.java +++ b/core-java-modules/core-java-numbers-7/src/test/java/com/baeldung/securerandompositivelong/SecureRandomPositiveLongUnitTest.java @@ -2,7 +2,6 @@ package com.baeldung.securerandompositivelong; import org.junit.jupiter.api.Test; -import java.math.BigDecimal; import java.security.SecureRandom; import static org.assertj.core.api.Assertions.assertThat; @@ -16,7 +15,8 @@ public class SecureRandomPositiveLongUnitTest { assertThat(randomPositiveLong).isPositive(); - Double pc = 1.0 / Math.pow(2, 63); + //Double pc = 1.0 / Math.pow(2, 63); + Double pc = 1.0 / Long.MAX_VALUE; System.out.printf("%.40f", pc); assertThat(pc).isLessThan(0.00000000000000001);