Java Random Name randomName()

Here you can find the source of randomName()

Description

Return a generated short, random string

License

Open Source License

Return

String

Declaration

public static String randomName() 

Method Source Code

//package com.java2s;

public class Main {
    private static long next;

    /**/*from  ww w .j  a v  a2 s.  c o m*/
     * Return a generated short, random string
     *
     * @return String
     */
    public static String randomName() {
        return "TMP_" + next++;
    }

    /**
     * Return a generated short, random string
     *
     * @param prefix the prefix name
     * @return String
     */
    public static String randomName(String prefix) {
        return prefix + "_" + next++;
    }
}

Related

  1. getRandomName()
  2. randomFilename()
  3. randomFileName()
  4. randomIndexName()
  5. randomName()
  6. randomName()