“Java Random Uuid” Code-Antworten

Java Random Uuid

String id = UUID.randomUUID().toString();
Merlin4 (ranken)

Java Random Uuid


import java.security.SecureRandom;
import java.util.UUID;

public class RandomUtil {
    // Maxim: Copied from UUID implementation :)
    private static volatile SecureRandom numberGenerator = null;
    private static final long MSB = 0x8000000000000000L;

    public static String unique() {
        SecureRandom ng = numberGenerator;
        if (ng == null) {
            numberGenerator = ng = new SecureRandom();
        }

        return Long.toHexString(MSB | ng.nextLong()) + Long.toHexString(MSB | ng.nextLong());
    }       
}

Comfortable Caiman

Java erzeugt Uuid

public static void main(String[] args) {
    final String uuid = UUID.randomUUID().toString().replace("-", "");
    System.out.println("uuid = " + uuid);
}
Lively Lyrebird

Ähnliche Antworten wie “Java Random Uuid”

Fragen ähnlich wie “Java Random Uuid”

Weitere verwandte Antworten zu “Java Random Uuid” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen