Demonstrating a bug in java.util.Random
This commit is contained in:
@@ -89,7 +89,7 @@ public class HobbitDraftTest {
|
|||||||
private static void doRandomTest(int nextIntValue, boolean getFloatBeforeInt) {
|
private static void doRandomTest(int nextIntValue, boolean getFloatBeforeInt) {
|
||||||
System.out.println("Get float before int: " + getFloatBeforeInt);
|
System.out.println("Get float before int: " + getFloatBeforeInt);
|
||||||
System.out.println("Next int value: " + nextIntValue);
|
System.out.println("Next int value: " + nextIntValue);
|
||||||
int[] values = new int[4];
|
int[] values = new int[nextIntValue];
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
Random rnd = new Random(i);
|
Random rnd = new Random(i);
|
||||||
if (getFloatBeforeInt)
|
if (getFloatBeforeInt)
|
||||||
|
|||||||
Reference in New Issue
Block a user