Save This Page
Home » openjdk-7 » java » security » [javadoc | source]
java.security
final class: VMSecureRandom [javadoc | source]
java.lang.Object
   java.security.VMSecureRandom
VM-specific methods for generating real (or almost real) random seeds. VM implementors should write a version of this class that reads random bytes from some system source.

The default implementation of this class runs eight threads that increment counters in a tight loop, and XORs each counter to produce one byte of seed data. This is not very efficient, and is not guaranteed to be random (the thread scheduler is probably deterministic, after all). If possible, VM implementors should reimplement this class so it obtains a random seed from a system facility, such as a system entropy gathering device or hardware random number generator.
Nested Class Summary:
static class  VMSecureRandom.Spinner   
Method from java.security.VMSecureRandom Summary:
generateSeed
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.security.VMSecureRandom Detail:
 static int generateSeed(byte[] buffer,
    int offset,
    int length) 
    Generate a random seed. Implementations are free to generate fewer random bytes than are requested, and leave the remaining bytes of the destination buffer as zeros. Implementations SHOULD, however, make a best-effort attempt to satisfy the request.