}
}
List<UUID> generateUuids(UUIDMethod method, int count, String name)
{
UUIDGenerator gen = UUIDGenerator.getInstance();
ArrayList<UUID> uuids = new ArrayList<UUID>(count);
for (int i = 0; i < count; ++i) {
UUID uuid;
switch (method) {
case RANDOM: // UUID using ~128 bits of randomness
uuid = gen.generateRandomBasedUUID();
break;
case TIME: // UUID using time+location
uuid = gen.generateTimeBasedUUID(mMacAddress);
break;
case NAME: // UUID computed from the given name
/* Note: we do NOT use a context value, for simplicity --
* usually one should be used, and UUID class already
* specifies 4 suggested standard contexts
*/
uuid = gen.generateNameBasedUUID(null, name);
break;
default:
throw new Error(); // never gets here
}
uuids.add(uuid);