org.apache.mahout.common
Class DevURandomSeedGenerator

java.lang.Object
  extended by org.apache.mahout.common.DevURandomSeedGenerator
All Implemented Interfaces:
org.uncommons.maths.random.SeedGenerator

public final class DevURandomSeedGenerator
extends Object
implements org.uncommons.maths.random.SeedGenerator

RNG seed strategy that gets data from /dev/urandom on systems that provide it (e.g. Solaris/Linux). If /dev/random does not exist or is not accessible, a SeedException is thrown. The point of pulling from /dev/urandom instead of from /dev/random is that /dev/random will block if it doesn't think it has enough entropy. In most production applications of Mahout, that really isn't necessary.


Constructor Summary
DevURandomSeedGenerator()
           
 
Method Summary
 byte[] generateSeed(int length)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DevURandomSeedGenerator

public DevURandomSeedGenerator()
Method Detail

generateSeed

public byte[] generateSeed(int length)
                    throws org.uncommons.maths.random.SeedException
Specified by:
generateSeed in interface org.uncommons.maths.random.SeedGenerator
Returns:
The requested number of random bytes, read directly from /dev/urandom.
Throws:
org.uncommons.maths.random.SeedException - If /dev/urandom does not exist or is not accessible

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.