Java tutorial
//package com.java2s; //License from project: Apache License import java.util.LinkedList; import java.util.List; import java.util.UUID; public class Main { private static final List<UUID> usedUUIDs = new LinkedList<UUID>(); public static UUID randomUUID() { UUID ret; do { ret = UUID.randomUUID(); } while (usedUUIDs.contains(ret)); usedUUIDs.add(ret); return ret; } }