prng.collector.FreeMemoryEntropy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SecurePRNG-core Show documentation
Show all versions of SecurePRNG-core Show documentation
The core random number generators
package prng.collector;
import prng.config.Config;
/**
* Use the amount of free memory available to the VM at a given time as a source of entropy
*
* @author Simon Greatrix
*/
public class FreeMemoryEntropy extends EntropyCollector {
/**
* Create a collector that uses the current free memory amount to produce entropy
*
* @param config configuration for this
*/
public FreeMemoryEntropy(Config config) {
super(config, 100);
}
@Override
protected boolean initialise() {
return true;
}
@Override
protected void runImpl() {
long memory = Runtime.getRuntime().freeMemory() >> 2;
setEvent((short) memory);
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy