From 4fa3406022128bc5b6139664ad068487c7f5b651 Mon Sep 17 00:00:00 2001 From: Chris Hennick Date: Thu, 27 Jul 2017 21:19:53 +0000 Subject: [PATCH] Fixes #18 Make random.org requests in a static synchronized method, since random.org doesn't allow multiple requests in parallel. --- .../org/uncommons/maths/random/RandomDotOrgSeedGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/java/main/org/uncommons/maths/random/RandomDotOrgSeedGenerator.java b/core/src/java/main/org/uncommons/maths/random/RandomDotOrgSeedGenerator.java index da922bd..4f625f7 100644 --- a/core/src/java/main/org/uncommons/maths/random/RandomDotOrgSeedGenerator.java +++ b/core/src/java/main/org/uncommons/maths/random/RandomDotOrgSeedGenerator.java @@ -98,7 +98,7 @@ public byte[] generateSeed(int length) throws SeedException * is greater than that permitted by random.org for a single request. * @throws IOException If there is a problem downloading the random bits. */ - private void refreshCache(int requiredBytes) throws IOException + private static synchronized void refreshCache(int requiredBytes) throws IOException { int numberOfBytes = Math.max(requiredBytes, cache.length); numberOfBytes = Math.min(numberOfBytes, MAX_REQUEST_SIZE);