All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prng.collector.FreeMemoryEntropy Maven / Gradle / Ivy

There is a newer version: 0.7
Show newest version
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