Class KeyGenerator


  • public class KeyGenerator
    extends java.lang.Object
    Object which can generate a sequence of private keys. The values returned by the next() method should in general not be easy to guess.
    Since:
    26 Oct 2010
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyGenerator​(java.lang.String prefix, int nchar, java.util.Random random)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Random createRandom()
      Returns a new, randomly seeded, Random object.
      java.lang.String next()
      Returns the next key in the sequence.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KeyGenerator

        public KeyGenerator​(java.lang.String prefix,
                            int nchar,
                            java.util.Random random)
        Constructor.
        Parameters:
        prefix - prefix prepended to all generated keys
        nchar - number of characters in generated keys
        random - random number generator
    • Method Detail

      • next

        public java.lang.String next()
        Returns the next key in the sequence. Guaranteed different from any previous return value from this method.
        Returns:
        key string
      • createRandom

        public static java.util.Random createRandom()
        Returns a new, randomly seeded, Random object.
        Returns:
        random