using Long.MAX_VALUE

This commit is contained in:
@hangga 2024-01-20 08:51:12 +07:00
parent 41370497fd
commit ce62cb3dc0
1 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,6 @@ package com.baeldung.securerandompositivelong;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import java.security.SecureRandom; import java.security.SecureRandom;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -16,7 +15,8 @@ public class SecureRandomPositiveLongUnitTest {
assertThat(randomPositiveLong).isPositive(); 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); System.out.printf("%.40f", pc);
assertThat(pc).isLessThan(0.00000000000000001); assertThat(pc).isLessThan(0.00000000000000001);