Java Random randomID()

Here you can find the source of randomID()

Description

Generate a random ID.

License

Open Source License

Return

a String represents the random ID

Declaration

public static String randomID() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*  w w  w. j ava 2  s .com*/
     * Generate a random ID.
     * It depends on the application nature and purpose that different strategies can be used.
     * E.g. single threaded --> current milliseconds since epoch
     * UUID and hash can also be feasible in certain cases
     * @return a String represents the random ID
     */
    public static String randomID() {
        return System.currentTimeMillis() + "";
    }
}

Related

  1. randomFloatBetween(float begin, float end)
  2. randomFromIterator(Iterator iter)
  3. randomGaussian(int numElements)
  4. randomGreyLevels(double max, double min)
  5. randomIcon()
  6. randomId()
  7. randomIndices(Random r, int minCount, int maxCount)
  8. randomInRange(double min, double max)
  9. randomInsults()