Class AnuQuantumSeedClient
- java.lang.Object
-
- io.github.pr0methean.betterrandom.seed.WebSeedClient
-
- io.github.pr0methean.betterrandom.seed.AnuQuantumSeedClient
-
- All Implemented Interfaces:
SeedGenerator
,Serializable
public class AnuQuantumSeedClient extends WebSeedClient
API client for the Australian National University's quantum RNG, which extracts randomness from quantum-vacuum fluctuations. Unlike random.org, this API has no usage quotas; the generator produces 5.7 Gbps, so the output rate is limited only by network bandwidth.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class io.github.pr0methean.betterrandom.seed.WebSeedClient
CLOCK, earliestNextAttempt, JSON_PARSER, lock, userAgent
-
Fields inherited from interface io.github.pr0methean.betterrandom.seed.SeedGenerator
EMPTY_SEED
-
-
Constructor Summary
Constructors Constructor Description AnuQuantumSeedClient()
AnuQuantumSeedClient(WebSeedClientConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
downloadBytes(HttpURLConnection connection, byte[] seed, int offset, int length)
Performs a single request for random bytes.protected URL
getConnectionUrl(int numBytes)
protected int
getMaxRequestSize()
Returns the maximum number of bytes that can be obtained with one request to the service.-
Methods inherited from class io.github.pr0methean.betterrandom.seed.WebSeedClient
checkedGetObject, divideRoundingUp, equals, generateSeed, getProxy, getResponseReader, getRetryDelayMs, getSocketFactory, hashCode, isWorthTrying, modRange1ToM, openConnection, parseJsonResponse
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.pr0methean.betterrandom.seed.SeedGenerator
generateSeed
-
-
-
-
Constructor Detail
-
AnuQuantumSeedClient
public AnuQuantumSeedClient()
-
AnuQuantumSeedClient
public AnuQuantumSeedClient(WebSeedClientConfiguration configuration)
-
-
Method Detail
-
getMaxRequestSize
protected int getMaxRequestSize()
Description copied from class:WebSeedClient
Returns the maximum number of bytes that can be obtained with one request to the service. When a seed larger than this is needed, it is obtained using multiple requests.- Specified by:
getMaxRequestSize
in classWebSeedClient
- Returns:
- the maximum number of bytes per request
-
getConnectionUrl
protected URL getConnectionUrl(int numBytes)
- Specified by:
getConnectionUrl
in classWebSeedClient
-
downloadBytes
protected void downloadBytes(HttpURLConnection connection, byte[] seed, int offset, int length) throws IOException
Description copied from class:WebSeedClient
Performs a single request for random bytes.- Specified by:
downloadBytes
in classWebSeedClient
- Parameters:
connection
- the connection to download fromseed
- the array to save them tooffset
- the first index to save them to in the arraylength
- the number of bytes to download- Throws:
IOException
- if a connection error occurs
-
-