package bridlensis.env;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class DefaultNameGenerator implements NameGenerator {

	private MessageDigest md;

	public DefaultNameGenerator() {
		try {
			md = MessageDigest.getInstance("MD5");
		} catch (NoSuchAlgorithmException e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	public String generate() {
		md.reset();
		md.update(Double.toHexString(Math.random()).getBytes());
		byte[] digest = md.digest();

		StringBuilder name = new StringBuilder(6);
		name.append('s');
		for (int i = 0; i < 5; i++) {
			int val = (digest[i] & 0xff) + 0x100;
			name.append(Integer.toString(val, 16).substring(1));
		}
		return name.toString();
	}

}

@@ -24,95 +24,8 @@
 %0D%0A%0D%0A
-import java.security.MessageDigest;%0D%0Aimport java.security.NoSuchAlgorithmException;%0D%0A%0D%0A
 publ
@@ -97,24 +97,42 @@
 ate 
-MessageDigest md
+char prefix;%0D%0A%09private short count
 ;%0D%0A%0D
@@ -172,439 +172,223 @@
 %0D%0A%09%09
-try %7B%0D%0A%09%09%09md = MessageDigest.getInstance(%22MD5%22);%0D%0A%09%09%7D catch (NoSuchAlgorithmException e) %7B%0D%0A%09%09%09throw new RuntimeException(e);%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09public String generate() %7B%0D%0A%09%09md.reset();%0D%0A%09%09md.update(Double.toHexString(Math.random()).getBytes());%0D%0A%09%09byte%5B%5D digest = md.digest();%0D%0A%0D%0A%09%09StringBuilder name = new StringBuilder(6);%0D%0A%09%09name.append('s');%0D%0A%09%09for (int i = 0; i %3C 5; i++) %7B%0D%0A%09%09%09int val = (digest%5Bi%5D & 0xff) + 0x100
+prefix = 'b';%0D%0A%09%09count = 1;%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09public String generate() %7B%0D%0A%09%09if (count == Short.MAX_VALUE) %7B%0D%0A%09%09%09prefix++;%0D%0A%09%09%09count = 1;%0D%0A%09%09%7D%0D%0A%09%09StringBuilder name = new StringBuilder(6);%0D%0A%09%09name.append(prefix)
 ;%0D%0A
-%09
 %09%09na
@@ -401,53 +401,40 @@
 end(
-Integer.toString(val, 16).substring(1));%0D%0A%09%09%7D
+String.format(%22%2505d%22, count++));
 %0D%0A%09%09

Change DefaultNameGenerator to generate naturally increasing numbers instead of hash values