Java UUID Create genRandom(int length)

Here you can find the source of genRandom(int length)

Description

gen Random

License

Open Source License

Declaration

public static String genRandom(int length) 

Method Source Code


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

import java.util.UUID;

public class Main {
    public static String genRandom(int length) {
        StringBuffer sb = new StringBuffer();
        while (sb.length() < length) {
            String random = UUID.randomUUID().toString().replace("-", "");
            sb.append(random);/* w w  w.  j  a va 2s.  c o m*/
        }
        return sb.toString().substring(0, length);
    }
}

Related

  1. generatorToken()
  2. generatorTransactionPath(String namespace)
  3. genMonUUID(String prefix)
  4. genMsgId()
  5. genOntologyNS(String base)
  6. genRandomString(int len)
  7. get36UUID()
  8. getUUID()
  9. getUUID()