Class KeyGenerator

java.lang.Object
org.astrogrid.samp.hub.KeyGenerator

public class KeyGenerator extends 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 Details

    • KeyGenerator

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

    • next

      public 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 Random createRandom()
      Returns a new, randomly seeded, Random object.
      Returns:
      random